@altertable/data-app 0.64.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 +40 -0
- package/CONTRIBUTING.md +37 -3
- package/README.md +2 -2
- package/dist/chunks/{contract-mwe7gnmh.js → contract-13j5zb3c.js} +110 -216
- 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-awa2d5b1.js +272 -0
- package/dist/chunks/contract-awa2d5b1.js.map +12 -0
- package/dist/chunks/{contract-xtxza1fy.js → contract-e11m4y7f.js} +35 -71
- package/dist/chunks/contract-e11m4y7f.js.map +12 -0
- package/dist/chunks/{contract-zr3jd7mr.js → contract-h8a6f559.js} +100 -75
- 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 +25 -13
- package/dist/embed/index.js.map +3 -3
- package/dist/local.js +1 -1
- package/dist/local.js.map +2 -2
- package/dist/react/embed/index.js +5 -2
- package/dist/react/embed/index.js.map +3 -3
- package/dist/react/index.js +2532 -11273
- package/dist/react/index.js.map +16 -88
- 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/iframe.d.ts +2 -0
- package/dist/types/client/index.d.ts +2 -0
- package/dist/types/client/logger.d.ts +6 -0
- package/dist/types/core/annotations.d.ts +92 -0
- package/dist/types/core/appearance.d.ts +2 -2
- package/dist/types/core/bridge-endpoint.d.ts +21 -0
- package/dist/types/core/bridge.d.ts +137 -16
- package/dist/types/core/contract.d.ts +2 -0
- package/dist/types/core/logger.d.ts +12 -0
- package/dist/types/core/presentation.d.ts +2 -0
- package/dist/types/core/variables.d.ts +2 -5
- package/dist/types/embed/host.d.ts +6 -2
- package/dist/types/embed/index.d.ts +1 -0
- package/dist/types/embed/source.d.ts +1 -1
- 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/embed/bridge.d.ts +1 -1
- package/dist/types/react/hooks.d.ts +29 -787
- package/dist/types/react/index.d.ts +30 -104
- 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 +6 -7
- 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 -53
- 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 +4 -0
- 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/Toast.d.ts +8 -0
- 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/csv-export.d.ts +19 -0
- package/dist/types/react/ui/data-context.d.ts +18 -7
- package/dist/types/react/ui/icons.d.ts +2 -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/dist/worker.js +381 -79
- package/docs/app-authoring.md +64 -30
- package/docs/data-context.md +89 -0
- package/docs/embed.md +1 -1
- package/docs/formatting-and-appearance.md +52 -0
- package/docs/hosted-apps.md +2 -15
- package/docs/layout.md +33 -0
- package/docs/local-data-apps.md +1 -1
- package/docs/react-embed.md +2 -2
- package/docs/react.md +20 -254
- 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 +89 -44
- package/package.json +13 -4
- package/dist/chunks/contract-cxr9t12b.js +0 -18
- package/dist/chunks/contract-cxr9t12b.js.map +0 -10
- package/dist/chunks/contract-mwe7gnmh.js.map +0 -13
- package/dist/chunks/contract-txjy0en2.js.map +0 -10
- package/dist/chunks/contract-xtxza1fy.js.map +0 -12
- package/dist/chunks/contract-yxbjea23.js.map +0 -12
- package/dist/chunks/contract-zr3jd7mr.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
|
@@ -9,6 +9,12 @@ export type Shortcut = {
|
|
|
9
9
|
key: string;
|
|
10
10
|
};
|
|
11
11
|
export declare const shortcuts: {
|
|
12
|
+
readonly annotate: {
|
|
13
|
+
readonly modifier: 'mod';
|
|
14
|
+
readonly shift: true;
|
|
15
|
+
readonly code: 'Period';
|
|
16
|
+
readonly key: '.';
|
|
17
|
+
};
|
|
12
18
|
readonly refresh: {
|
|
13
19
|
readonly modifier: 'alt';
|
|
14
20
|
readonly code: 'KeyR';
|
|
@@ -29,4 +35,4 @@ export declare function shortcutLabel({ modifier, shift, key }: Shortcut): strin
|
|
|
29
35
|
export declare function ariaKeyShortcuts({ modifier, shift, key }: Shortcut): string;
|
|
30
36
|
export declare function isEditingTarget(target: EventTarget | null): boolean;
|
|
31
37
|
/** Bind a page-level shortcut. Ignored while typing or while a modal layer is open. */
|
|
32
|
-
export declare function useShortcut(shortcut: Shortcut, action: () => void, enabled?: boolean): void;
|
|
38
|
+
export declare function useShortcut(shortcut: Shortcut, action: () => void, enabled?: boolean, allowWhileEditing?: boolean): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DataContext } from './ui/data-context.js';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { DataView, DisplayedSnapshot } from '../core/data-view.js';
|
|
4
|
+
import type { DisclosedQuery } from '../core/contract.js';
|
|
5
|
+
import type { EmptyContent } from './ui/presentation.js';
|
|
6
|
+
export type ViewResult<Data, Input> = {
|
|
7
|
+
dataContext: DataContext;
|
|
8
|
+
view: DataView<Data, Input>;
|
|
9
|
+
snapshot?: DisplayedSnapshot<Data, Input>;
|
|
10
|
+
refetch: () => unknown;
|
|
11
|
+
cancel: () => unknown;
|
|
12
|
+
refreshing: boolean;
|
|
13
|
+
queries?: DisclosedQuery[];
|
|
14
|
+
controls?: ReactNode;
|
|
15
|
+
emptyFallback: EmptyContent;
|
|
16
|
+
};
|
|
17
|
+
/** The executor is private; declarations expose data composition, not subscription hooks. */
|
|
18
|
+
export declare class DeclaredView<Data, Input, Definition = unknown> {
|
|
19
|
+
#private;
|
|
20
|
+
constructor(useResult: () => ViewResult<Data, Input>, definition?: Definition);
|
|
21
|
+
static definition<Data, Input, Definition>(view: DeclaredView<Data, Input, Definition>): Definition;
|
|
22
|
+
static useResult<Data, Input>(view: DeclaredView<Data, Input>): ViewResult<Data, Input>;
|
|
23
|
+
}
|
|
24
|
+
export declare function useDeclaredResult<Data, Input>(view: DeclaredView<Data, Input>): ViewResult<Data, Input>;
|
|
25
|
+
export declare const PrimaryViewContext: import("react").Context<{
|
|
26
|
+
declaration: object;
|
|
27
|
+
result: ViewResult<unknown, unknown>;
|
|
28
|
+
} | null>;
|
|
29
|
+
export declare function getViewDefinition<Data, Input, Definition>(view: DeclaredView<Data, Input, Definition>): Definition;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataContext } from './ui/data-context.js';
|
|
1
2
|
import type { EmptyContent } from './ui/presentation.js';
|
|
2
3
|
import type { AppVariableValues, DateRangeVariable, VariableCollection } from '../core/variables.js';
|
|
3
4
|
import type { DateRangeRequest } from '../core/contract.js';
|
|
@@ -16,21 +17,37 @@ export type ViewDate<Variables extends VariableCollection, Input> = {
|
|
|
16
17
|
export type ViewBindings<Variables extends VariableCollection, Input> = Partial<{
|
|
17
18
|
[Key in keyof Variables]: (input: Input) => ResolvedVariables<Variables>[Key];
|
|
18
19
|
}>;
|
|
20
|
+
type SameViewInput<Variables extends VariableCollection, Input> = [
|
|
21
|
+
ResolvedVariables<Variables>
|
|
22
|
+
] extends [Input] ? [Input] extends [ResolvedVariables<Variables>] ? [Input] extends [Record<string, never>] ? true : [keyof Input] extends [keyof Variables] ? true : false : false : false;
|
|
23
|
+
type ViewInputMapping<Variables extends VariableCollection, Input> = SameViewInput<Variables, Input> extends true ? {
|
|
24
|
+
input?: (values: ResolvedVariables<Variables>) => Input;
|
|
25
|
+
} : {
|
|
26
|
+
input: (values: ResolvedVariables<Variables>) => Input;
|
|
27
|
+
};
|
|
19
28
|
export type DataViewDefinition<Name extends string, Variables extends VariableCollection, Input, Data> = {
|
|
20
29
|
operation: Name;
|
|
21
|
-
|
|
22
|
-
input: (values: ResolvedVariables<Variables>) => Input;
|
|
30
|
+
dataContext: DataContext;
|
|
23
31
|
bindings?: ViewBindings<Variables, Input>;
|
|
24
32
|
/** App-owned semantics: measured zero need not mean an empty result. */
|
|
25
33
|
isEmpty: (data: Data) => boolean;
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
/** Inherited by DataSection unless it supplies its own copy. */
|
|
35
|
+
emptyFallback: EmptyContent;
|
|
36
|
+
} & (keyof Variables extends never ? {
|
|
37
|
+
variables?: Variables;
|
|
38
|
+
} : {
|
|
39
|
+
variables: Variables;
|
|
40
|
+
}) & ViewInputMapping<NoInfer<Variables>, Input> & ({
|
|
28
41
|
date: ViewDate<Variables, Input>;
|
|
29
42
|
describeInput?: (input: Input) => string;
|
|
30
43
|
} | {
|
|
31
44
|
date?: never;
|
|
32
45
|
describeInput: (input: Input) => string;
|
|
33
46
|
});
|
|
47
|
+
export type ResolvedDataViewDefinition<Name extends string, Variables extends VariableCollection, Input, Data> = Omit<DataViewDefinition<Name, Variables, Input, Data>, 'variables' | 'input'> & {
|
|
48
|
+
variables: Variables;
|
|
49
|
+
input: (values: ResolvedVariables<Variables>) => Input;
|
|
50
|
+
};
|
|
34
51
|
export declare function describeViewInput<Input>(definition: {
|
|
35
52
|
variables: VariableCollection;
|
|
36
53
|
bindings?: Partial<Record<string, (input: Input) => unknown>>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type Dataset, type Metric, type ViewSource } from './bindings.js';
|
|
2
|
+
import { type MetricWidgetProps as DisplayMetricProps } from './ui/MetricWidget.js';
|
|
3
|
+
import { type TableWidgetProps as DisplayTableProps, type TableDisplayMode } from './ui/TableWidget.js';
|
|
4
|
+
import { type VisualizationWidgetProps as DisplayVisualProps, type VisualizationWidgetView as DisplayVisualizationView } from './ui/VisualizationWidget.js';
|
|
5
|
+
import { type TextWidgetProps as DisplayTextProps } from './ui/TextWidget.js';
|
|
6
|
+
import { type DataValueProps as DisplayValueProps } from './ui/DataValue.js';
|
|
7
|
+
import type { MetricValues } from '../core/reading.js';
|
|
8
|
+
import type { MetricDefinition } from './ui/metric.js';
|
|
9
|
+
import type { ReactNode } from 'react';
|
|
10
|
+
import type { DataReading } from '../core/reading.js';
|
|
11
|
+
export type MetricWidgetProps<Data = unknown, Input = unknown> = Omit<Extract<DisplayMetricProps, {
|
|
12
|
+
metric: MetricDefinition;
|
|
13
|
+
}>, 'metric' | 'reading'> & {
|
|
14
|
+
metric: Metric<Data, Input>;
|
|
15
|
+
source: ViewSource<Data, Input>;
|
|
16
|
+
};
|
|
17
|
+
export declare function MetricWidget<Data, Input>({ metric, source, ...presentation }: MetricWidgetProps<Data, Input>): import("react").JSX.Element;
|
|
18
|
+
type BoundTableProps<Row> = Extract<DisplayTableProps<Row>, {
|
|
19
|
+
reading: DataReading<readonly Row[]>;
|
|
20
|
+
}>;
|
|
21
|
+
type TablePresentation<Row> = Pick<BoundTableProps<Row>, 'title' | 'columns' | 'rowKey' | 'reading' | 'evidence' | 'emptyFallback'>;
|
|
22
|
+
export type TableWidgetProps<Row, Data = unknown, Input = unknown> = Omit<BoundTableProps<Row>, keyof TablePresentation<Row> | 'limit' | 'pagination'> & TableDisplayMode & {
|
|
23
|
+
dataset: Dataset<Data, Input, Row>;
|
|
24
|
+
source: ViewSource<Data, Input>;
|
|
25
|
+
title?: ReactNode;
|
|
26
|
+
};
|
|
27
|
+
export declare function TableWidget<Row, Data, Input>({ dataset, source, title, ...presentation }: TableWidgetProps<Row, Data, Input>): import("react").JSX.Element;
|
|
28
|
+
type BoundVisual<Row> = Extract<DisplayVisualProps<readonly Row[]>, {
|
|
29
|
+
reading: DataReading<readonly Row[]>;
|
|
30
|
+
}>;
|
|
31
|
+
export type VisualizationWidgetView<Row> = DisplayVisualizationView<readonly Row[]>;
|
|
32
|
+
type VisualContent<Row> = {
|
|
33
|
+
children: (rows: readonly Row[]) => ReactNode;
|
|
34
|
+
views?: never;
|
|
35
|
+
viewLabel?: never;
|
|
36
|
+
initialView?: never;
|
|
37
|
+
} | {
|
|
38
|
+
children?: never;
|
|
39
|
+
views: readonly VisualizationWidgetView<Row>[];
|
|
40
|
+
viewLabel: string;
|
|
41
|
+
initialView?: string;
|
|
42
|
+
};
|
|
43
|
+
export type VisualizationWidgetProps<Row, Data = unknown, Input = unknown> = Omit<BoundVisual<Row>, 'reading' | 'isEmpty' | 'emptyFallback' | 'evidence' | 'title' | 'children' | 'views' | 'viewLabel' | 'initialView'> & VisualContent<Row> & {
|
|
44
|
+
dataset: Dataset<Data, Input, Row>;
|
|
45
|
+
source: ViewSource<Data, Input>;
|
|
46
|
+
title?: ReactNode;
|
|
47
|
+
};
|
|
48
|
+
export declare function VisualizationWidget<Row, Data, Input>({ dataset, source, title, ...presentation }: VisualizationWidgetProps<Row, Data, Input>): import("react").JSX.Element;
|
|
49
|
+
type NarrativeBinding<Data, Input, Row> = {
|
|
50
|
+
metric: Metric<Data, Input>;
|
|
51
|
+
dataset?: never;
|
|
52
|
+
source: ViewSource<Data, Input>;
|
|
53
|
+
children?: (values: MetricValues) => ReactNode;
|
|
54
|
+
} | {
|
|
55
|
+
metric?: never;
|
|
56
|
+
dataset: Dataset<Data, Input, Row>;
|
|
57
|
+
source: ViewSource<Data, Input>;
|
|
58
|
+
children: (rows: readonly Row[]) => ReactNode;
|
|
59
|
+
};
|
|
60
|
+
export type TextWidgetProps<Data = unknown, Input = unknown, Row = never> = Omit<Extract<DisplayTextProps<unknown>, {
|
|
61
|
+
reading: DataReading<unknown>;
|
|
62
|
+
}>, 'reading' | 'evidence' | 'children' | 'title' | 'emptyFallback'> & NarrativeBinding<Data, Input, Row> & {
|
|
63
|
+
title?: ReactNode;
|
|
64
|
+
};
|
|
65
|
+
export declare function TextWidget<Data, Input, Row>(props: TextWidgetProps<Data, Input, Row>): import("react").JSX.Element;
|
|
66
|
+
type InlinePresentation = Omit<DisplayValueProps<unknown>, 'reading' | 'children' | 'loadingFallback'> & {
|
|
67
|
+
loadingFallback?: ReactNode;
|
|
68
|
+
};
|
|
69
|
+
export type DataValueProps<Data = unknown, Input = unknown, Row = never> = InlinePresentation & ((NarrativeBinding<Data, Input, Row> & {
|
|
70
|
+
scope?: never;
|
|
71
|
+
}) | {
|
|
72
|
+
metric?: never;
|
|
73
|
+
dataset?: never;
|
|
74
|
+
source?: never;
|
|
75
|
+
scope: DataReading<string>;
|
|
76
|
+
children?: (scope: string) => ReactNode;
|
|
77
|
+
});
|
|
78
|
+
export declare function DataValue<Data, Input, Row>(props: DataValueProps<Data, Input, Row>): import("react").JSX.Element;
|
|
79
|
+
export {};
|