@altertable/data-app 0.69.0 → 0.70.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 +4 -0
- package/dist/chunks/{index-m0gbxtgp.js → index-2ajhmsc4.js} +3 -3
- package/dist/chunks/{index-m0gbxtgp.js.map → index-2ajhmsc4.js.map} +1 -1
- package/dist/chunks/{index-2sbp9h2b.js → index-58kks6a8.js} +1 -1
- package/dist/chunks/{index-2sbp9h2b.js.map → index-58kks6a8.js.map} +2 -2
- package/dist/chunks/{index-ap60vggk.js → index-7q99hf1z.js} +18 -11
- package/dist/chunks/index-7q99hf1z.js.map +10 -0
- package/dist/chunks/{index-kwnqycjt.js → index-9zqbrv2z.js} +7 -3
- package/dist/chunks/index-9zqbrv2z.js.map +10 -0
- package/dist/chunks/{index-k766wwwr.js → index-q1w84fv9.js} +167 -24
- package/dist/chunks/index-q1w84fv9.js.map +15 -0
- package/dist/chunks/{index-zcqxfwdq.js → index-rew95tbg.js} +85 -10
- package/dist/chunks/index-rew95tbg.js.map +13 -0
- package/dist/chunks/{index-qhzdzca2.js → index-vtpygsbq.js} +2392 -991
- package/dist/chunks/index-vtpygsbq.js.map +126 -0
- package/dist/chunks/{index-r7b1ftwy.js → index-wjt6cavj.js} +5 -3
- package/dist/chunks/index-wjt6cavj.js.map +10 -0
- package/dist/chunks/{index-sx488hvs.js → index-xzb7sx6g.js} +3 -3
- package/dist/client/index.js +5 -5
- package/dist/core/config.js +2 -2
- package/dist/core/contract.js +6 -6
- package/dist/core/contract.js.map +1 -1
- package/dist/embed/index.js +5 -5
- package/dist/index.js +2 -2
- package/dist/local.js +35 -2
- package/dist/local.js.map +8 -6
- package/dist/preview.js +15 -15
- package/dist/preview.js.map +6 -6
- package/dist/react/embed/index.js +1 -1
- package/dist/react/index.js +273 -331
- package/dist/react/index.js.map +5 -8
- package/dist/react/ui/index.js +874 -502
- package/dist/react/ui/index.js.map +24 -23
- package/dist/server.js +35 -2
- package/dist/server.js.map +8 -6
- package/dist/types/client/data-client.d.ts +21 -10
- package/dist/types/core/config.d.ts +20 -17
- package/dist/types/core/contract.d.ts +23 -13
- package/dist/types/core/dimension-source.d.ts +64 -0
- package/dist/types/core/dimension.d.ts +31 -23
- package/dist/types/core/facets.d.ts +13 -0
- package/dist/types/core/keys.d.ts +2 -0
- package/dist/types/core/operation-types.d.ts +6 -5
- package/dist/types/core/queries.d.ts +75 -7
- package/dist/types/core/variables.d.ts +38 -12
- package/dist/types/embed/sql.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/react/actions.d.ts +53 -0
- package/dist/types/react/bindings.d.ts +36 -0
- package/dist/types/react/details.d.ts +46 -0
- package/dist/types/react/exploration.d.ts +44 -0
- package/dist/types/react/hooks.d.ts +76 -38
- package/dist/types/react/index.d.ts +3 -0
- package/dist/types/react/style-contract.d.ts +1 -1
- package/dist/types/react/ui/AboutData.d.ts +9 -4
- package/dist/types/react/ui/AreaChart.d.ts +2 -2
- package/dist/types/react/ui/BarChart.d.ts +2 -2
- package/dist/types/react/ui/Button.d.ts +2 -1
- package/dist/types/react/ui/ComposedChartLegend.d.ts +2 -1
- package/dist/types/react/ui/DataApp.d.ts +3 -0
- package/dist/types/react/ui/DataWidget.d.ts +3 -0
- package/dist/types/react/ui/DimensionPicker.d.ts +2 -2
- package/dist/types/react/ui/ExplorationActionControl.d.ts +60 -0
- package/dist/types/react/ui/InspectionProvider.d.ts +2 -2
- package/dist/types/react/ui/LineChart.d.ts +2 -2
- package/dist/types/react/ui/Menu.d.ts +3 -2
- package/dist/types/react/ui/MetricWidget.d.ts +2 -0
- package/dist/types/react/ui/PickerField.d.ts +9 -1
- package/dist/types/react/ui/PieChart.d.ts +2 -2
- package/dist/types/react/ui/Select.d.ts +5 -1
- package/dist/types/react/ui/Sheet.d.ts +1 -1
- package/dist/types/react/ui/TrendChart.d.ts +3 -3
- package/dist/types/react/ui/VisualizationWidget.d.ts +1 -1
- package/dist/types/react/ui/chart-data.d.ts +8 -6
- package/dist/types/react/ui/chart-date-axis.d.ts +1 -1
- package/dist/types/react/ui/chart-interaction.d.ts +15 -9
- package/dist/types/react/ui/chart-time.d.ts +8 -5
- package/dist/types/react/ui/icons.d.ts +2 -0
- package/dist/types/react/ui/index.d.ts +2 -0
- package/dist/types/react/ui/use-chart-scroll-to-end.d.ts +2 -0
- package/dist/types/react/view-control-bar.d.ts +6 -4
- package/dist/types/react/view-runtime.d.ts +5 -2
- package/dist/types/react/view.d.ts +15 -6
- package/dist/types/react/widgets.d.ts +22 -11
- package/dist/worker.js +1 -1
- package/docs/app-authoring.md +10 -3
- package/docs/client.md +5 -6
- package/docs/composition.md +84 -0
- package/docs/contract.md +41 -21
- package/docs/data-context.md +2 -0
- package/docs/server.md +1 -1
- package/docs/styling.md +4 -0
- package/docs/ui.md +12 -1
- package/docs/variables.md +83 -11
- package/docs/views.md +56 -2
- package/docs/widgets.md +93 -0
- package/examples/starter-data-app/index.tsx +10 -22
- package/examples/starter-local-data-app/app.ts +7 -1
- package/examples/starter-local-data-app/tsconfig.json +7 -1
- package/package.json +1 -1
- package/dist/chunks/index-ap60vggk.js.map +0 -10
- package/dist/chunks/index-k766wwwr.js.map +0 -13
- package/dist/chunks/index-kwnqycjt.js.map +0 -10
- package/dist/chunks/index-qhzdzca2.js.map +0 -118
- package/dist/chunks/index-r7b1ftwy.js.map +0 -10
- package/dist/chunks/index-zcqxfwdq.js.map +0 -13
- /package/dist/chunks/{index-sx488hvs.js.map → index-xzb7sx6g.js.map} +0 -0
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/** Declared views, bound widgets, and layouts for data-app authoring. */
|
|
2
2
|
export type { DatasetColumn, DatasetSuggestionOptions, DatasetDeclaration as DatasetDefinition, } from './bindings.js';
|
|
3
|
+
export type { MetricRecords } from './bindings.js';
|
|
3
4
|
export { injectDataAppStyles } from './styles.js';
|
|
4
5
|
export type { DataAppStylesOptions } from './styles.js';
|
|
5
6
|
export type { DataAppStyle, DataAppStyleToken, DataAppStyleHooks, } from './style-contract.js';
|
|
6
7
|
export { mountDataApp } from './mount.js';
|
|
7
8
|
export { createDataHooks } from './hooks.js';
|
|
9
|
+
export { DetailView, DetailContent, useDetailNavigation, } from './details.js';
|
|
10
|
+
export type { DetailViewDefinition } from './details.js';
|
|
8
11
|
export type { CsvCell } from './ui/csv-export.js';
|
|
9
12
|
export { DataApp } from './ui/DataApp.js';
|
|
10
13
|
export type { DataAppProps } from './ui/DataApp.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
/** Public custom-property names for authoring types and validation. CSS owns their defaults. */
|
|
3
|
-
export declare const dataAppStyleTokens: readonly ['--atbl-control-text-size', '--atbl-annotation-accent', '--atbl-annotation-accent-hover', '--atbl-annotation-on-accent', '--atbl-annotation-highlight', '--atbl-background', '--atbl-surface', '--atbl-subtle', '--atbl-text', '--atbl-muted', '--atbl-border', '--atbl-accent', '--atbl-accent-subtle', '--atbl-on-accent', '--atbl-positive', '--atbl-negative', '--atbl-danger', '--atbl-danger-subtle', '--atbl-backdrop', '--atbl-code-surface', '--atbl-code-text', '--atbl-code-keyword', '--atbl-chart-fill', '--atbl-control-hover-border', '--atbl-focus-color', '--atbl-focus-outline', '--atbl-focus-ring-offset', '--atbl-focus-ring-inset', '--atbl-font', '--atbl-font-heading', '--atbl-mono-font', '--atbl-space-xs', '--atbl-space-sm', '--atbl-space-md', '--atbl-space-lg', '--atbl-space-xl', '--atbl-layout-gap', '--atbl-surface-padding', '--atbl-content-width', '--atbl-control-height', '--atbl-radius-control', '--atbl-radius-surface', '--atbl-radius-overlay', '--atbl-shadow-surface', '--atbl-shadow-overlay', '--atbl-shadow-control', '--atbl-cursor-action', '--atbl-cursor-disabled', '--atbl-cursor-help', '--atbl-duration-fast', '--atbl-duration-normal', '--atbl-duration-slow', '--atbl-ease-standard', '--atbl-ease-enter', '--atbl-chart-1', '--atbl-chart-2', '--atbl-chart-3', '--atbl-chart-4', '--atbl-chart-5', '--atbl-chart-6', '--atbl-chart-7', '--atbl-chart-8', '--atbl-type-emphasis-weight', '--atbl-type-meta-weight', '--atbl-type-page-size', '--atbl-type-section-size', '--atbl-type-widget-size', '--atbl-type-body-size', '--atbl-type-label-size', '--atbl-type-meta-size', '--atbl-type-metric-size', '--atbl-type-heading-weight', '--atbl-type-label-weight', '--atbl-type-body-leading', '--atbl-type-label-leading', '--atbl-type-heading-leading', '--atbl-type-metric-leading', '--atbl-text-measure', '--atbl-control-compact-height', '--atbl-control-icon-size', '--atbl-control-padding-inline', '--atbl-control-padding-block', '--atbl-control-gap', '--atbl-control-disabled-opacity', '--atbl-cursor-busy', '--atbl-control-hover-surface', '--atbl-control-pressed-surface', '--atbl-control-open-surface', '--atbl-control-open-border', '--atbl-control-selected-surface', '--atbl-control-selected-text'];
|
|
3
|
+
export declare const dataAppStyleTokens: readonly ['--atbl-control-text-size', '--atbl-annotation-accent', '--atbl-annotation-accent-hover', '--atbl-annotation-on-accent', '--atbl-annotation-highlight', '--atbl-background', '--atbl-surface', '--atbl-subtle', '--atbl-text', '--atbl-muted', '--atbl-border', '--atbl-accent', '--atbl-accent-subtle', '--atbl-on-accent', '--atbl-positive', '--atbl-negative', '--atbl-danger', '--atbl-danger-subtle', '--atbl-backdrop', '--atbl-code-surface', '--atbl-code-text', '--atbl-code-keyword', '--atbl-chart-fill', '--atbl-control-hover-border', '--atbl-focus-color', '--atbl-focus-outline', '--atbl-focus-ring-offset', '--atbl-focus-ring-inset', '--atbl-font', '--atbl-font-heading', '--atbl-mono-font', '--atbl-space-xs', '--atbl-space-sm', '--atbl-space-md', '--atbl-space-lg', '--atbl-space-xl', '--atbl-layout-gap', '--atbl-surface-padding', '--atbl-content-width', '--atbl-control-height', '--atbl-dropdown-padding', '--atbl-dropdown-item-padding-block', '--atbl-dropdown-item-padding-inline', '--atbl-dropdown-item-gap', '--atbl-radius-control', '--atbl-radius-surface', '--atbl-radius-overlay', '--atbl-shadow-surface', '--atbl-shadow-overlay', '--atbl-shadow-control', '--atbl-cursor-action', '--atbl-cursor-disabled', '--atbl-cursor-help', '--atbl-duration-fast', '--atbl-duration-normal', '--atbl-duration-slow', '--atbl-ease-standard', '--atbl-ease-enter', '--atbl-chart-1', '--atbl-chart-2', '--atbl-chart-3', '--atbl-chart-4', '--atbl-chart-5', '--atbl-chart-6', '--atbl-chart-7', '--atbl-chart-8', '--atbl-type-emphasis-weight', '--atbl-type-meta-weight', '--atbl-type-page-size', '--atbl-type-section-size', '--atbl-type-widget-size', '--atbl-type-body-size', '--atbl-type-label-size', '--atbl-type-meta-size', '--atbl-type-metric-size', '--atbl-type-heading-weight', '--atbl-type-label-weight', '--atbl-type-body-leading', '--atbl-type-label-leading', '--atbl-type-heading-leading', '--atbl-type-metric-leading', '--atbl-text-measure', '--atbl-control-compact-height', '--atbl-control-icon-size', '--atbl-control-padding-inline', '--atbl-control-padding-block', '--atbl-control-gap', '--atbl-control-disabled-opacity', '--atbl-cursor-busy', '--atbl-control-hover-surface', '--atbl-control-pressed-surface', '--atbl-control-open-surface', '--atbl-control-open-border', '--atbl-control-selected-surface', '--atbl-control-selected-text'];
|
|
4
4
|
/** Stable component roots for CSS customization; only utilities may be placed on native markup. */
|
|
5
5
|
export declare const dataAppStyleClasses: {
|
|
6
6
|
readonly 'altertable-app-layout': {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { type ComponentPropsWithRef, type ReactNode, type RefObject } from 'react';
|
|
1
|
+
import { type ComponentPropsWithRef, type ComponentRef, type ReactNode, type RefObject } from 'react';
|
|
2
2
|
import type { DisclosedQuery } from '../../core/contract.js';
|
|
3
3
|
import type { DataContext, GlossaryEntry } from './data-context.js';
|
|
4
4
|
import { type ButtonProps } from './Button.js';
|
|
5
5
|
import { type SheetDialogProps } from './Sheet.js';
|
|
6
|
-
export type
|
|
6
|
+
export type InspectionRecords = {
|
|
7
|
+
scope: string;
|
|
8
|
+
content: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export type AboutTab = 'records' | 'glossary' | 'queries';
|
|
7
11
|
export declare function resolveAboutTab(tab: string | null | undefined): AboutTab;
|
|
8
12
|
export type AboutEmpty = {
|
|
9
13
|
glossary: {
|
|
@@ -33,6 +37,7 @@ export type AboutSubject = {
|
|
|
33
37
|
entries: readonly GlossaryEntry[];
|
|
34
38
|
};
|
|
35
39
|
queries?: DisclosedQuery[];
|
|
40
|
+
records?: InspectionRecords;
|
|
36
41
|
};
|
|
37
42
|
export type AboutDataProps = AboutSubject & {
|
|
38
43
|
variant?: ButtonProps['variant'];
|
|
@@ -58,11 +63,11 @@ export type AboutDataProps = AboutSubject & {
|
|
|
58
63
|
* Open state uses `?about=`; tab selection uses `?tab=`. Enable the global shortcut only on the
|
|
59
64
|
* page-level trigger.
|
|
60
65
|
*/
|
|
61
|
-
export declare function InspectionSheet({ id, title, description, visual, visualKind, dataContext, references, queries, empty, footer, sheetProps, headerActions, open, onOpenChange, tab, onTabChange, returnFocus, }: AboutDataProps & {
|
|
66
|
+
export declare function InspectionSheet({ id, title, description, visual, visualKind, dataContext, references, queries, records, empty, footer, sheetProps, headerActions, open, onOpenChange, tab, onTabChange, returnFocus, }: AboutDataProps & {
|
|
62
67
|
open: boolean;
|
|
63
68
|
onOpenChange: (open: boolean) => void;
|
|
64
69
|
tab: AboutTab;
|
|
65
70
|
onTabChange: (tab: AboutTab) => void;
|
|
66
|
-
returnFocus: RefObject<
|
|
71
|
+
returnFocus: RefObject<ComponentRef<'button'> | null>;
|
|
67
72
|
}): import("react").JSX.Element;
|
|
68
73
|
export declare function AboutData(props: AboutDataProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChartItem, ValueChartProps } from './chart-data.js';
|
|
2
2
|
export type AreaChartItem = ChartItem;
|
|
3
|
-
export type AreaChartProps = ValueChartProps
|
|
3
|
+
export type AreaChartProps<Row extends AreaChartItem = AreaChartItem> = ValueChartProps<Row>;
|
|
4
4
|
/** Ordered finite samples filled to a zero baseline, including negative values.
|
|
5
5
|
* Samples are equally spaced; supply missing periods explicitly.
|
|
6
6
|
* Compose inside VisualizationWidget; hover/touch tooltips need no caller state. */
|
|
7
|
-
export declare function AreaChart(props: AreaChartProps): import("react").JSX.Element;
|
|
7
|
+
export declare function AreaChart<Row extends AreaChartItem>(props: AreaChartProps<Row>): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ChartItem, type ValueChartProps } from './chart-data.js';
|
|
2
2
|
export type BarChartItem = ChartItem;
|
|
3
|
-
export type BarChartProps = ValueChartProps
|
|
3
|
+
export type BarChartProps<Row extends BarChartItem = BarChartItem> = ValueChartProps<Row>;
|
|
4
4
|
/** Nonnegative category values. Compose inside VisualizationWidget for a titled panel.
|
|
5
5
|
* Owns hover/touch tooltips; no selection state or keyboard navigation. */
|
|
6
|
-
export declare function BarChart({ items, unit, ariaLabel, formatValue, }: BarChartProps): import("react").JSX.Element;
|
|
6
|
+
export declare function BarChart<Row extends BarChartItem>({ items, unit, ariaLabel, formatValue, itemActions, }: BarChartProps<Row>): import("react").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
import { Button as AriaButton } from 'react-aria-components';
|
|
3
3
|
export type ButtonProps = ComponentPropsWithRef<'button'> & {
|
|
4
|
-
|
|
4
|
+
/** Inline actions retain button semantics without a padded control surface. */
|
|
5
|
+
variant?: 'primary' | 'elevated' | 'outline' | 'ghost' | 'inline';
|
|
5
6
|
size?: 'default' | 'compact' | 'icon' | 'icon-compact';
|
|
6
7
|
};
|
|
7
8
|
export declare function Button({ className, type, variant, size, disabled, ...props }: ButtonProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
2
|
import { Legend } from 'recharts';
|
|
3
3
|
export type ComposedChartLegendProps = ComponentProps<typeof Legend> & {
|
|
4
4
|
maxVisibleItems?: number;
|
|
5
5
|
};
|
|
6
6
|
/** Opt in inside ComposedChart to derive the shared legend from its displayed series.
|
|
7
|
+
* Give native series unique IDs when they share a data key.
|
|
7
8
|
* Native positioning, sorting, formatters, callbacks, and custom content remain available. */
|
|
8
9
|
export declare function ComposedChartLegend({ maxVisibleItems, ...props }: ComposedChartLegendProps): import("react").JSX.Element;
|
|
@@ -3,6 +3,7 @@ import type { DisplayedSnapshot } from '../../core/data-view.js';
|
|
|
3
3
|
import type { StoryFinding } from './story.js';
|
|
4
4
|
import { type DataAppBaseProps, type DataAppControlProps } from './DataAppFrame.js';
|
|
5
5
|
import { type DeclaredView } from '../view-runtime.js';
|
|
6
|
+
import { type DetailContent } from '../details.js';
|
|
6
7
|
export type DataAppProps<Data, Input = unknown> = Omit<DataAppBaseProps, 'dataContext'> & DataAppControlProps & {
|
|
7
8
|
view: DeclaredView<Data, Input> & {
|
|
8
9
|
scope(snapshot: DisplayedSnapshot<Data, Input>): string;
|
|
@@ -16,6 +17,8 @@ export type DataAppProps<Data, Input = unknown> = Omit<DataAppBaseProps, 'dataCo
|
|
|
16
17
|
ExportDataset<Data, Input>,
|
|
17
18
|
...ExportDataset<Data, Input>[]
|
|
18
19
|
];
|
|
20
|
+
/** Detail destinations available to dataset actions and metric record inspection. */
|
|
21
|
+
details?: readonly DetailContent<any, any>[];
|
|
19
22
|
};
|
|
20
23
|
/** Executes the primary view and owns its controls, inspection, exports, and stories. */
|
|
21
24
|
export declare function DataApp<Data, Input>(props: DataAppProps<Data, Input>): import("react").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InspectionRecords } from './AboutData.js';
|
|
1
2
|
import { type ComponentPropsWithRef, type ReactNode } from 'react';
|
|
2
3
|
import { type WidgetStatus } from './RequestHint.js';
|
|
3
4
|
import type { EmptyContent, BoundWidgetReading } from './presentation.js';
|
|
@@ -12,6 +13,8 @@ type DataWidgetBaseProps = {
|
|
|
12
13
|
count?: number;
|
|
13
14
|
description?: ReactNode;
|
|
14
15
|
evidence?: WidgetEvidence;
|
|
16
|
+
/** Lazy detail records rendered as the first inspection tab. */
|
|
17
|
+
records?: InspectionRecords;
|
|
15
18
|
action?: ReactNode;
|
|
16
19
|
/** Reserved feedback slot; retain displayed content while refreshing or after failure. */
|
|
17
20
|
status?: WidgetStatus;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ControlLabelPlacement } from './PickerField.js';
|
|
2
|
-
import type { DimensionOption, DimensionSelection, DimensionValue,
|
|
2
|
+
import type { DimensionOption, DimensionSelection, DimensionValue, DimensionSelectionVariable } from '../../core/dimension.js';
|
|
3
3
|
/** Adapts the typed dimension contract to the shared ChoicePicker control. */
|
|
4
4
|
export declare function DimensionPicker<T extends DimensionValue>({ filter, labelPlacement, value, onChange, options: suppliedOptions, loading, error, onRetry, }: {
|
|
5
|
-
filter:
|
|
5
|
+
filter: DimensionSelectionVariable<T>;
|
|
6
6
|
labelPlacement?: ControlLabelPlacement;
|
|
7
7
|
value: DimensionSelection<T>;
|
|
8
8
|
onChange: (value: DimensionSelection<T>) => void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ComponentRef, type RefObject, type Ref, type KeyboardEvent } from 'react';
|
|
2
|
+
/** A resolved action available for one displayed exploration item. */
|
|
3
|
+
export type ExplorationAction = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
onSelect: (trigger?: HTMLElement | SVGElement) => void;
|
|
7
|
+
/** Keep this action directly available when other actions require a menu. */
|
|
8
|
+
primary?: boolean;
|
|
9
|
+
/** Keep utility actions separate from exploration destinations. */
|
|
10
|
+
group?: 'clipboard';
|
|
11
|
+
};
|
|
12
|
+
/** Resolves the actions available for a displayed domain row. */
|
|
13
|
+
export type ItemActions<Row> = (row: Row) => readonly ExplorationAction[];
|
|
14
|
+
export type ExplorationActionControlProps = {
|
|
15
|
+
actions: readonly ExplorationAction[];
|
|
16
|
+
/** Identifies the item whose actions the control exposes. */
|
|
17
|
+
ariaLabel: string;
|
|
18
|
+
/** Use when another item-level hit target already exposes the primary action. */
|
|
19
|
+
hidePrimary?: boolean;
|
|
20
|
+
/** Own a context menu without adding a second visible or keyboard trigger. */
|
|
21
|
+
contextOnly?: boolean;
|
|
22
|
+
/** Chart labels use a chevron; other action menus use an ellipsis. */
|
|
23
|
+
indicator?: 'ellipsis' | 'chevron';
|
|
24
|
+
/** Shares this menu trigger with an item's context and keyboard actions. */
|
|
25
|
+
ref?: Ref<HTMLButtonElement>;
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Presents exploration actions consistently: a sole action is direct, an explicit
|
|
30
|
+
* primary action stays direct, and all available choices remain in the menu.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ExplorationActionControl({ actions, ariaLabel, className, hidePrimary, contextOnly, indicator, ref, }: ExplorationActionControlProps): import("react").JSX.Element | null;
|
|
33
|
+
/** Menu content for an item-level trigger composed by a chart or custom control. */
|
|
34
|
+
export declare function ExplorationActionMenu({ actions, ariaLabel, triggerRef, placement, }: Pick<ExplorationActionControlProps, 'actions' | 'ariaLabel'> & {
|
|
35
|
+
triggerRef?: RefObject<ComponentRef<'button'> | null>;
|
|
36
|
+
placement?: 'bottom' | 'bottom start' | 'bottom end';
|
|
37
|
+
}): import("react").JSX.Element;
|
|
38
|
+
/** Adds clipboard utilities derived only from the displayed chart item. */
|
|
39
|
+
export declare function useChartActions(): {
|
|
40
|
+
actions(declared: readonly ExplorationAction[], label: string, summary: string): readonly ExplorationAction[];
|
|
41
|
+
feedback: import("react").JSX.Element | null;
|
|
42
|
+
};
|
|
43
|
+
export declare function openExplorationMenu(trigger: RefObject<HTMLButtonElement | null>, event: {
|
|
44
|
+
preventDefault: () => void;
|
|
45
|
+
currentTarget?: EventTarget | null;
|
|
46
|
+
}, point?: {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
}): void;
|
|
50
|
+
/** Reuse the item's menu for pointer and keyboard context requests. */
|
|
51
|
+
export declare function explorationMenuEvents(trigger: RefObject<HTMLButtonElement | null>): {
|
|
52
|
+
onContextMenu: (event: {
|
|
53
|
+
preventDefault: () => void;
|
|
54
|
+
clientX: number;
|
|
55
|
+
clientY: number;
|
|
56
|
+
}) => void;
|
|
57
|
+
onKeyDown(event: KeyboardEvent<Element>): void;
|
|
58
|
+
};
|
|
59
|
+
/** The direct action for an item, when the action declaration supplies one. */
|
|
60
|
+
export declare function getPrimaryExplorationAction(actions: readonly ExplorationAction[]): ExplorationAction | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type ReactNode, type RefObject } from 'react';
|
|
1
|
+
import { type ComponentRef, type ReactNode, type RefObject } from 'react';
|
|
2
2
|
import { type AboutDataProps, type AboutTab } from './AboutData.js';
|
|
3
3
|
type Inspection = {
|
|
4
4
|
key: string;
|
|
5
5
|
id: string;
|
|
6
6
|
props: AboutDataProps;
|
|
7
|
-
trigger: RefObject<
|
|
7
|
+
trigger: RefObject<ComponentRef<'button'> | null>;
|
|
8
8
|
};
|
|
9
9
|
type Selection = {
|
|
10
10
|
inspection: Inspection;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChartItem, ValueChartProps } from './chart-data.js';
|
|
2
2
|
export type LineChartItem = ChartItem;
|
|
3
|
-
export type LineChartProps = ValueChartProps
|
|
3
|
+
export type LineChartProps<Row extends LineChartItem = LineChartItem> = ValueChartProps<Row>;
|
|
4
4
|
/** Equally spaced finite samples in supplied order; fill missing periods explicitly.
|
|
5
5
|
* Supports negative values, single points, and horizontal scrolling for long series.
|
|
6
6
|
* Compose inside VisualizationWidget; hover/touch tooltips need no caller state. */
|
|
7
|
-
export declare function LineChart(props: LineChartProps): import("react").JSX.Element;
|
|
7
|
+
export declare function LineChart<Row extends LineChartItem>(props: LineChartProps<Row>): import("react").JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
-
import { MenuTrigger, MenuSection,
|
|
2
|
+
import { MenuTrigger, MenuSection, Separator, type MenuProps, type MenuItemProps, type MenuTriggerProps } from 'react-aria-components';
|
|
3
|
+
import { PopoverSurface } from './PopoverSurface.js';
|
|
3
4
|
export { MenuTrigger, MenuSection };
|
|
4
5
|
export { PressButton as MenuButton } from './Button.js';
|
|
5
6
|
export type { MenuProps, MenuItemProps, MenuTriggerProps };
|
|
6
|
-
export type MenuPopoverProps = ComponentPropsWithRef<typeof
|
|
7
|
+
export type MenuPopoverProps = ComponentPropsWithRef<typeof PopoverSurface>;
|
|
7
8
|
/** Anchored popup for a Menu; the surrounding MenuTrigger owns focus and dismissal. */
|
|
8
9
|
export declare function MenuPopover({ className, placement, ...props }: MenuPopoverProps): import("react").JSX.Element;
|
|
9
10
|
/** Actions by default; single selection creates radio items, multiple creates checkbox items. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InspectionRecords } from './AboutData.js';
|
|
1
2
|
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
3
|
import type { WidgetStatus } from './RequestHint.js';
|
|
3
4
|
import type { WidgetEvidence } from './WidgetEvidence.js';
|
|
@@ -13,6 +14,7 @@ type MetricWidgetBaseProps = {
|
|
|
13
14
|
description?: ReactNode;
|
|
14
15
|
comparison?: MetricComparison;
|
|
15
16
|
evidence?: WidgetEvidence;
|
|
17
|
+
records?: InspectionRecords;
|
|
16
18
|
action?: ReactNode;
|
|
17
19
|
status?: WidgetStatus;
|
|
18
20
|
visual?: ReactNode;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import { type AppIconName } from './icons.js';
|
|
2
3
|
/** Inline labels sit with the value; above and beside labels have a separate layout slot. */
|
|
3
4
|
export type ControlLabelPlacement = 'inline' | 'above' | 'beside';
|
|
4
5
|
/** Popup triggers retain their accessible names when the visible label moves outside. */
|
|
@@ -7,9 +8,16 @@ export declare function PickerField({ label, labelPlacement, children, }: {
|
|
|
7
8
|
labelPlacement?: ControlLabelPlacement;
|
|
8
9
|
children: ReactNode;
|
|
9
10
|
}): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
11
|
+
/** Shared label and value slots for pickers and active-filter summaries. */
|
|
12
|
+
export declare function ControlLabelValue({ label, value, }: {
|
|
13
|
+
label?: ReactNode;
|
|
14
|
+
value: ReactNode;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
10
16
|
/** Shared label, value, and disclosure layout for selection and predicate controls. */
|
|
11
|
-
export declare function PickerTriggerContent({ label, labelPlacement, value, }: {
|
|
17
|
+
export declare function PickerTriggerContent({ label, labelPlacement, value, icon, iconSize, }: {
|
|
12
18
|
label: string;
|
|
13
19
|
labelPlacement: ControlLabelPlacement;
|
|
14
20
|
value: ReactNode;
|
|
21
|
+
icon?: AppIconName;
|
|
22
|
+
iconSize?: number;
|
|
15
23
|
}): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChartItem, ValueChartProps } from './chart-data.js';
|
|
2
2
|
export type PieChartItem = ChartItem;
|
|
3
|
-
export type PieChartProps = ValueChartProps & {
|
|
3
|
+
export type PieChartProps<Row extends PieChartItem = PieChartItem> = ValueChartProps<Row> & {
|
|
4
4
|
/** Omit the built-in key when composing a separate ChartLegend. */
|
|
5
5
|
showLegend?: boolean;
|
|
6
6
|
};
|
|
@@ -8,4 +8,4 @@ export type PieChartProps = ValueChartProps & {
|
|
|
8
8
|
* Include Other to represent the whole. Zero values remain in the legend; all-zero
|
|
9
9
|
* data shows an empty circle. Colors follow item order. Compose inside VisualizationWidget;
|
|
10
10
|
* hover/touch tooltips coordinate slice and legend emphasis without caller state. */
|
|
11
|
-
export declare function PieChart({ items, unit, ariaLabel, showLegend, formatValue, }: PieChartProps): import("react").JSX.Element;
|
|
11
|
+
export declare function PieChart<Row extends PieChartItem>({ items, unit, ariaLabel, showLegend, formatValue, itemActions, }: PieChartProps<Row>): import("react").JSX.Element;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { type ControlLabelPlacement } from './PickerField.js';
|
|
2
2
|
import { type ChoiceOption } from '../../core/variables.js';
|
|
3
|
+
import type { AppIconName } from './icons.js';
|
|
3
4
|
export type SelectProps = {
|
|
4
5
|
label: string;
|
|
5
6
|
labelPlacement?: ControlLabelPlacement;
|
|
7
|
+
/** Replace the inline text label with a decorative icon; the accessible label remains. */
|
|
8
|
+
icon?: AppIconName;
|
|
9
|
+
size?: 'default' | 'compact';
|
|
6
10
|
options: readonly ChoiceOption[];
|
|
7
11
|
value: string;
|
|
8
12
|
onChange: (value: string) => void;
|
|
@@ -15,4 +19,4 @@ export type SelectProps = {
|
|
|
15
19
|
align?: 'start' | 'end';
|
|
16
20
|
};
|
|
17
21
|
/** Labeled single selection with keyboard navigation and a styled listbox. */
|
|
18
|
-
export declare function Select({ label, options, value, onChange, disabled, required, className, align, labelPlacement, ...props }: SelectProps): import("react").JSX.Element;
|
|
22
|
+
export declare function Select({ label, options, value, onChange, disabled, required, className, align, labelPlacement, icon, size, ...props }: SelectProps): import("react").JSX.Element;
|
|
@@ -12,7 +12,7 @@ export type SheetProps = {
|
|
|
12
12
|
placement?: 'side' | 'center';
|
|
13
13
|
/** Edge for side placement. Defaults to right; small screens use a bottom sheet. */
|
|
14
14
|
side?: 'left' | 'right';
|
|
15
|
-
returnFocus?: RefObject<HTMLElement | null>;
|
|
15
|
+
returnFocus?: RefObject<HTMLElement | SVGElement | null>;
|
|
16
16
|
} & SheetDialogProps;
|
|
17
17
|
/**
|
|
18
18
|
* Uses the native dialog top layer and focus trap. Closing keeps the modal mounted until its
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ValueChartProps } from './chart-data.js';
|
|
1
|
+
import type { ChartItem, ValueChartProps } from './chart-data.js';
|
|
2
2
|
/** Ordered, equally spaced samples; negative values share an explicit zero baseline. */
|
|
3
|
-
export declare function TrendChart({ items, unit, ariaLabel, formatValue,
|
|
4
|
-
area
|
|
3
|
+
export declare function TrendChart<Row extends ChartItem>({ items, unit, ariaLabel, formatValue, kind, itemActions, }: ValueChartProps<Row> & {
|
|
4
|
+
kind: 'line' | 'area';
|
|
5
5
|
}): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef, type ReactNode } from 'react';
|
|
2
2
|
import { type DataWidgetProps } from './DataWidget.js';
|
|
3
3
|
import type { BoundWidgetReading } from './presentation.js';
|
|
4
|
-
type VisualizationWidgetBaseProps = Pick<DataWidgetProps, 'title' | 'headingLevel' | 'annotationId' | 'description' | 'count' | 'action' | 'evidence' | 'status' | 'emptyFallback'> & {
|
|
4
|
+
type VisualizationWidgetBaseProps = Pick<DataWidgetProps, 'title' | 'headingLevel' | 'annotationId' | 'description' | 'count' | 'action' | 'evidence' | 'records' | 'status' | 'emptyFallback'> & {
|
|
5
5
|
/** Footer controls, such as table pagination. */
|
|
6
6
|
footer?: ReactNode;
|
|
7
7
|
} & Omit<ComponentPropsWithRef<'section'>, 'about' | 'title' | 'children'>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import type { ItemActions } from './ExplorationActionControl.js';
|
|
1
2
|
/** Ordered category or time-series sample. IDs are unique and nonblank; values are finite. */
|
|
2
3
|
export type ChartItem = {
|
|
3
4
|
id: string;
|
|
4
5
|
label: string;
|
|
5
6
|
value: number;
|
|
6
7
|
};
|
|
7
|
-
export type ValueChartProps = {
|
|
8
|
+
export type ValueChartProps<Row extends ChartItem = ChartItem> = {
|
|
8
9
|
/** Ordered samples; the chart validates IDs and values when rendering. */
|
|
9
|
-
items: readonly
|
|
10
|
+
items: readonly Row[];
|
|
11
|
+
/** Actions available for each displayed item. Domain fields remain available to this callback. */
|
|
12
|
+
itemActions?: ItemActions<Row>;
|
|
10
13
|
unit: string;
|
|
11
14
|
ariaLabel: string;
|
|
12
15
|
formatValue?: (value: number) => string;
|
|
@@ -27,8 +30,7 @@ export type ScatterChartItem = {
|
|
|
27
30
|
x: number;
|
|
28
31
|
y: number;
|
|
29
32
|
};
|
|
30
|
-
type
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export declare function validateChartItems<Kind extends ChartKind>(kind: Kind, items: readonly ItemFor<Kind>[]): void;
|
|
33
|
+
type ValueChartKind = 'bar' | 'line' | 'area' | 'pie';
|
|
34
|
+
export declare function validateValueChartItems(kind: ValueChartKind, items: readonly ChartItem[]): void;
|
|
35
|
+
export declare function validateScatterChartItems(items: readonly ScatterChartItem[]): void;
|
|
34
36
|
export {};
|
|
@@ -11,5 +11,5 @@ export declare function useDateAxisLabel(id?: string | number): LabelFormatter |
|
|
|
11
11
|
* Use scale="utc" for epoch milliseconds or type="category" for date-like categories.
|
|
12
12
|
* Explicit tick formatters and tick lists retain authored axis behavior.
|
|
13
13
|
*/
|
|
14
|
-
export declare function ChartXAxis<Row = unknown, Value = string | number>(props: ComponentProps<typeof XAxis<Row, Value>>): import("react").JSX.Element;
|
|
14
|
+
export declare function ChartXAxis<Row = unknown, Value = string | number | Date>(props: ComponentProps<typeof XAxis<Row, Value>>): import("react").JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
/** Coordinates in the chart SVG, shared by pointer tracking and active samples. */
|
|
3
|
+
export type ChartPoint = {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
type ChartInteractionApi = {
|
|
8
|
+
isPointerInspection: boolean;
|
|
9
|
+
activePoint: ChartPoint | undefined;
|
|
8
10
|
seriesCount: number;
|
|
11
|
+
/** Line and area series register the sample at the current inspection position. */
|
|
9
12
|
registerPoint: (id: string, x: number, y: number) => () => void;
|
|
10
13
|
registerSeries: (id: string) => () => void;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
+
activeSeriesId: string | null;
|
|
15
|
+
setHoveredSeriesId: (id: string | null) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const ChartInteractionContext: import("react").Context<ChartInteractionApi | null>;
|
|
18
|
+
export declare function isChartSeriesActive(interaction: ChartInteractionApi | null, seriesId: string): boolean;
|
|
14
19
|
export declare function useChartSeries(id?: string): {
|
|
15
20
|
id: string;
|
|
16
21
|
active: boolean;
|
|
@@ -19,3 +24,4 @@ export declare function ChartSeries({ id, children, }: {
|
|
|
19
24
|
id: string;
|
|
20
25
|
children: ReactNode;
|
|
21
26
|
}): import("react").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/** Only ISO calendar dates and zoned instants are inferred. Numbers require scale="utc". */
|
|
2
2
|
export declare function chartTimestamp(value: unknown, numeric?: boolean): number | null;
|
|
3
|
-
|
|
3
|
+
type ChartTimeModel = {
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
6
|
-
times: number[];
|
|
7
|
-
|
|
6
|
+
times: readonly number[];
|
|
7
|
+
/** Smallest gap in milliseconds; a single instant uses a one-day extent. */
|
|
8
|
+
minimumInterval: number;
|
|
8
9
|
tooltip: (value: unknown) => string;
|
|
9
|
-
}
|
|
10
|
-
export declare function
|
|
10
|
+
};
|
|
11
|
+
export declare function timeModel(values: readonly unknown[], numeric?: boolean): ChartTimeModel | null;
|
|
12
|
+
export declare function timeTicks(model: ChartTimeModel, width: number): {
|
|
11
13
|
ticks: number[];
|
|
12
14
|
label: (value: number, index: number) => {
|
|
13
15
|
main: string;
|
|
14
16
|
context: string;
|
|
15
17
|
};
|
|
16
18
|
};
|
|
19
|
+
export {};
|
|
@@ -7,6 +7,8 @@ declare const brandedIcons: {
|
|
|
7
7
|
readonly clock: import("lucide-react").LucideIcon;
|
|
8
8
|
readonly check: import("lucide-react").LucideIcon;
|
|
9
9
|
readonly disclosure: import("lucide-react").LucideIcon;
|
|
10
|
+
readonly breakdown: import("lucide-react").LucideIcon;
|
|
11
|
+
readonly moreActions: import("lucide-react").LucideIcon;
|
|
10
12
|
readonly previousMonth: import("lucide-react").LucideIcon;
|
|
11
13
|
readonly nextMonth: import("lucide-react").LucideIcon;
|
|
12
14
|
readonly explore: import("lucide-react").LucideIcon;
|
|
@@ -107,3 +107,5 @@ export type { SectionHeadingProps } from './SectionHeading.js';
|
|
|
107
107
|
export { DateDisplay } from './DateDisplay.js';
|
|
108
108
|
export type { DateDisplayProps } from './DateDisplay.js';
|
|
109
109
|
export { useDateFormatting } from '../date-formatting.js';
|
|
110
|
+
export { ExplorationActionControl } from './ExplorationActionControl.js';
|
|
111
|
+
export type { ExplorationActionControlProps, ExplorationAction, ItemActions, } from './ExplorationActionControl.js';
|
|
@@ -2,13 +2,15 @@ import { type ReactNode } from 'react';
|
|
|
2
2
|
export type ActiveFilterControl = {
|
|
3
3
|
id: string;
|
|
4
4
|
label: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
summary: string;
|
|
6
|
+
onRemove: () => void;
|
|
7
|
+
/** Render the editor and notify when it clears its own active filter. */
|
|
8
|
+
renderToolbarControl?: (onClear: () => void) => ReactNode;
|
|
7
9
|
};
|
|
8
|
-
export declare function ViewControlBar({ primaryFilters,
|
|
10
|
+
export declare function ViewControlBar({ primaryFilters, activeFilters, allFilters, activeFilterCount, displayOptions, changedDisplayOptionCount, onClear, }: {
|
|
9
11
|
primaryFilters: ReactNode[];
|
|
10
12
|
allFilters: ReactNode[];
|
|
11
|
-
|
|
13
|
+
activeFilters: ActiveFilterControl[];
|
|
12
14
|
activeFilterCount: number;
|
|
13
15
|
displayOptions: ReactNode[];
|
|
14
16
|
changedDisplayOptionCount: number;
|
|
@@ -21,11 +21,14 @@ export declare class DeclaredView<Data, Input, Definition = unknown> {
|
|
|
21
21
|
#private;
|
|
22
22
|
constructor(useResult: () => ViewResult<Data, Input>, definition?: Definition);
|
|
23
23
|
static definition<Data, Input, Definition>(view: DeclaredView<Data, Input, Definition>): Definition;
|
|
24
|
-
static useResult<
|
|
24
|
+
static useResult<View extends DeclaredView<unknown, unknown>>(view: View): DeclaredViewResult<View>;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
/** Distribute across declarations so each result keeps its own data and input together. */
|
|
27
|
+
type DeclaredViewResult<View> = View extends DeclaredView<infer Data, infer Input> ? ViewResult<Data, Input> : never;
|
|
28
|
+
export declare function useDeclaredResult<View extends DeclaredView<unknown, unknown>>(view: View): DeclaredViewResult<View>;
|
|
27
29
|
export declare const PrimaryViewContext: import("react").Context<{
|
|
28
30
|
declaration: object;
|
|
29
31
|
result: ViewResult<unknown, unknown>;
|
|
30
32
|
} | null>;
|
|
31
33
|
export declare function getViewDefinition<Data, Input, Definition>(view: DeclaredView<Data, Input, Definition>): Definition;
|
|
34
|
+
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { DataContext } from './ui/data-context.js';
|
|
2
2
|
import type { EmptyContent } from './ui/presentation.js';
|
|
3
|
-
import type { AppVariableValues, DateRangeVariable, VariableCollection } from '../core/variables.js';
|
|
3
|
+
import type { AppVariableValues, DateRangeVariable, VariableCollection, CheckedFacetContexts } from '../core/variables.js';
|
|
4
4
|
import type { DateRangeRequest } from '../core/contract.js';
|
|
5
|
+
type ResolvedVariable<Variable> = Variable extends DateRangeVariable ? DateRangeRequest : AppVariableValues<{
|
|
6
|
+
value: Variable;
|
|
7
|
+
}>['value'];
|
|
5
8
|
export type ResolvedVariables<Variables extends VariableCollection> = {
|
|
6
|
-
[Key in keyof Variables]: Variables[Key] extends
|
|
9
|
+
[Key in keyof Variables]: ResolvedVariable<Variables[Key]> | (string extends keyof Variables ? undefined : never);
|
|
7
10
|
};
|
|
8
11
|
type DateVariableKey<Variables extends VariableCollection> = {
|
|
9
12
|
[Key in keyof Variables]: Variables[Key] extends DateRangeVariable ? Key : never;
|
|
@@ -18,7 +21,9 @@ export type ViewBindings<Variables extends VariableCollection, Input> = Partial<
|
|
|
18
21
|
[Key in keyof Variables]: (input: Input) => ResolvedVariables<Variables>[Key];
|
|
19
22
|
}>;
|
|
20
23
|
type RequiredFilterBindingKeys<Variables extends VariableCollection, Input> = {
|
|
21
|
-
[Key in keyof Variables]:
|
|
24
|
+
[Key in keyof Variables]: Variables[Key]['kind'] extends 'dateRange' ? never : Variables[Key]['kind'] extends 'choice' ? [Input] extends [Record<Key, unknown>] ? ResolvedVariables<Variables>[Key] extends Input[Key] ? never : Key : Key : Extract<Variables[Key]['presentation'], {
|
|
25
|
+
group: 'display';
|
|
26
|
+
}> extends never ? [Input] extends [Record<Key, ResolvedVariables<Variables>[Key]>] ? [ResolvedVariables<Variables>[Key]] extends [Input[Key]] ? never : Key : Key : never;
|
|
22
27
|
}[keyof Variables];
|
|
23
28
|
/** Derive compatible top-level filter bindings; require readers for other input shapes. */
|
|
24
29
|
export type ViewBindingOptions<Variables extends VariableCollection, Input, AdditionalRequired extends keyof Variables = never> = [RequiredFilterBindingKeys<Variables, Input> | AdditionalRequired] extends [
|
|
@@ -32,7 +37,11 @@ export type ViewBindingOptions<Variables extends VariableCollection, Input, Addi
|
|
|
32
37
|
};
|
|
33
38
|
type SameViewInput<Variables extends VariableCollection, Input> = [
|
|
34
39
|
ResolvedVariables<Variables>
|
|
35
|
-
] extends [Input] ? [Input] extends [
|
|
40
|
+
] extends [Input] ? [Input] extends [
|
|
41
|
+
{
|
|
42
|
+
[Key in keyof Variables]: Variables[Key]['kind'] extends 'choice' ? string : ResolvedVariables<Variables>[Key];
|
|
43
|
+
}
|
|
44
|
+
] ? [Input] extends [Record<string, never>] ? true : [keyof Input] extends [keyof Variables] ? true : false : false : false;
|
|
36
45
|
type ViewInputMapping<Variables extends VariableCollection, Input> = SameViewInput<Variables, Input> extends true ? {
|
|
37
46
|
input?: (values: ResolvedVariables<Variables>) => Input;
|
|
38
47
|
} : {
|
|
@@ -46,9 +55,9 @@ export type DataViewDefinition<Name extends string, Variables extends VariableCo
|
|
|
46
55
|
/** Inherited by DataSection unless it supplies its own copy. */
|
|
47
56
|
emptyFallback: EmptyContent;
|
|
48
57
|
} & (keyof Variables extends never ? {
|
|
49
|
-
variables?: Variables
|
|
58
|
+
variables?: Variables & CheckedFacetContexts<NoInfer<Variables>>;
|
|
50
59
|
} : {
|
|
51
|
-
variables: Variables
|
|
60
|
+
variables: Variables & CheckedFacetContexts<NoInfer<Variables>>;
|
|
52
61
|
}) & ViewInputMapping<NoInfer<Variables>, Input> & ViewBindingOptions<NoInfer<Variables>, Input> & ({
|
|
53
62
|
date: ViewDate<Variables, Input>;
|
|
54
63
|
describeInput?: (input: Input) => string;
|