@altertable/data-app 0.68.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 +10 -0
- package/CONTRIBUTING.md +27 -1
- package/README.md +18 -21
- package/THIRD_PARTY_NOTICES +18 -0
- package/dist/chunks/index-22d576sn.js +153 -0
- package/dist/chunks/index-22d576sn.js.map +11 -0
- package/dist/chunks/index-2ajhmsc4.js +355 -0
- package/dist/chunks/index-2ajhmsc4.js.map +13 -0
- package/dist/chunks/{index-ktmvs916.js → index-58kks6a8.js} +37 -21
- package/dist/chunks/index-58kks6a8.js.map +13 -0
- package/dist/chunks/{index-23dktynd.js → index-7q99hf1z.js} +19 -12
- package/dist/chunks/index-7q99hf1z.js.map +10 -0
- package/dist/chunks/{index-mt93ff2b.js → index-9zqbrv2z.js} +7 -3
- package/dist/chunks/index-9zqbrv2z.js.map +10 -0
- package/dist/chunks/{index-m6n8ctfc.js → index-cv36cyna.js} +4 -4
- package/dist/chunks/index-cv36cyna.js.map +10 -0
- package/dist/chunks/{index-ag0cgnvq.js → index-q1w84fv9.js} +178 -31
- package/dist/chunks/index-q1w84fv9.js.map +15 -0
- package/dist/chunks/{index-qd5xgx6y.js → index-rew95tbg.js} +89 -21
- package/dist/chunks/index-rew95tbg.js.map +13 -0
- package/dist/chunks/{index-gvers8jw.js → index-vtpygsbq.js} +5651 -2711
- package/dist/chunks/index-vtpygsbq.js.map +126 -0
- package/dist/chunks/{index-x69p7cv7.js → index-wjt6cavj.js} +6 -4
- package/dist/chunks/index-wjt6cavj.js.map +10 -0
- package/dist/chunks/{index-f5cnbrjz.js → index-wss3gd3h.js} +39 -9
- package/dist/chunks/index-wss3gd3h.js.map +13 -0
- package/dist/chunks/{index-ev2b5aaf.js → index-xzb7sx6g.js} +4 -4
- package/dist/client/index.js +6 -6
- package/dist/core/appearance.js +1 -1
- package/dist/core/config.js +3 -3
- package/dist/core/contract.js +7 -7
- package/dist/core/contract.js.map +1 -1
- package/dist/core/format.js +10 -2
- package/dist/core/format.js.map +1 -1
- package/dist/embed/index.js +26 -25
- package/dist/embed/index.js.map +4 -4
- package/dist/index.js +3 -3
- package/dist/local.js +200 -145
- package/dist/local.js.map +10 -7
- package/dist/preview.js +1456 -0
- package/dist/preview.js.map +17 -0
- package/dist/react/embed/index.js +1 -1
- package/dist/react/index.js +500 -401
- package/dist/react/index.js.map +10 -13
- package/dist/react/ui/index.js +1851 -1476
- package/dist/react/ui/index.js.map +24 -21
- package/dist/server.js +102 -58
- package/dist/server.js.map +9 -6
- package/dist/types/client/data-client.d.ts +21 -10
- package/dist/types/client/download.d.ts +5 -0
- package/dist/types/client/iframe.d.ts +4 -2
- package/dist/types/client/logger.d.ts +10 -2
- package/dist/types/core/annotations.d.ts +5 -0
- package/dist/types/core/appearance.d.ts +2 -0
- package/dist/types/core/bridge-endpoint.d.ts +2 -2
- package/dist/types/core/bridge.d.ts +22 -0
- package/dist/types/core/config.d.ts +25 -17
- package/dist/types/core/contract.d.ts +26 -14
- package/dist/types/core/date-format.d.ts +24 -0
- package/dist/types/core/dimension-source.d.ts +64 -0
- package/dist/types/core/dimension.d.ts +33 -24
- package/dist/types/core/facets.d.ts +13 -0
- package/dist/types/core/filters.d.ts +4 -3
- package/dist/types/core/format.d.ts +5 -3
- package/dist/types/core/keys.d.ts +2 -0
- package/dist/types/core/messages.d.ts +3 -1
- package/dist/types/core/operation-types.d.ts +12 -11
- package/dist/types/core/queries.d.ts +75 -7
- package/dist/types/core/time-interval.d.ts +96 -0
- package/dist/types/core/variables.d.ts +49 -14
- package/dist/types/embed/host.d.ts +4 -4
- 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/annotations/annotation-editor-state.d.ts +2 -0
- package/dist/types/react/annotations/annotation-targets.d.ts +1 -0
- package/dist/types/react/annotations/getAnnotationProps.d.ts +5 -3
- package/dist/types/react/annotations/useAnnotationGeometry.d.ts +2 -2
- package/dist/types/react/bindings.d.ts +62 -3
- package/dist/types/react/date-formatting.d.ts +12 -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 +82 -43
- package/dist/types/react/index.d.ts +10 -2
- package/dist/types/react/search-suggestions.d.ts +8 -0
- package/dist/types/react/style-contract.d.ts +1 -5
- 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/ChartLegend.d.ts +3 -2
- package/dist/types/react/ui/ChoicePicker.d.ts +2 -0
- package/dist/types/react/ui/ComposedChartLegend.d.ts +2 -1
- package/dist/types/react/ui/DataApp.d.ts +8 -4
- package/dist/types/react/ui/DataAppFrame.d.ts +14 -3
- package/dist/types/react/ui/DataTable.d.ts +6 -4
- package/dist/types/react/ui/DataWidget.d.ts +7 -0
- package/dist/types/react/ui/DateDisplay.d.ts +9 -0
- package/dist/types/react/ui/DateRangePicker.d.ts +3 -1
- package/dist/types/react/ui/DateTimeTooltip.d.ts +3 -2
- package/dist/types/react/ui/DimensionPicker.d.ts +5 -3
- package/dist/types/react/ui/EmptyState.d.ts +1 -1
- package/dist/types/react/ui/ExplorationActionControl.d.ts +60 -0
- package/dist/types/react/ui/GradientScroll.d.ts +8 -0
- package/dist/types/react/ui/Grid.d.ts +1 -1
- 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 +4 -0
- package/dist/types/react/ui/NumberFilterPicker.d.ts +3 -1
- package/dist/types/react/ui/PeriodSummary.d.ts +2 -1
- package/dist/types/react/ui/PickerField.d.ts +23 -0
- package/dist/types/react/ui/PieChart.d.ts +2 -2
- package/dist/types/react/ui/PopoverSurface.d.ts +5 -0
- package/dist/types/react/ui/RequestHint.d.ts +2 -2
- package/dist/types/react/ui/SearchField.d.ts +3 -1
- package/dist/types/react/ui/SearchTypeahead.d.ts +15 -0
- package/dist/types/react/ui/SectionHeading.d.ts +8 -0
- package/dist/types/react/ui/Select.d.ts +9 -1
- package/dist/types/react/ui/Sheet.d.ts +4 -2
- package/dist/types/react/ui/TableWidget.d.ts +8 -0
- package/dist/types/react/ui/Tabs.d.ts +4 -3
- package/dist/types/react/ui/TrendChart.d.ts +3 -3
- package/dist/types/react/ui/VariableBar.d.ts +1 -1
- 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 +15 -0
- package/dist/types/react/ui/chart-interaction.d.ts +27 -0
- package/dist/types/react/ui/chart-primitives.d.ts +4 -4
- package/dist/types/react/ui/chart-time.d.ts +19 -0
- package/dist/types/react/ui/chartColor.d.ts +1 -1
- package/dist/types/react/ui/icons.d.ts +5 -1
- package/dist/types/react/ui/index.d.ts +10 -4
- package/dist/types/react/ui/metric-comparison.d.ts +2 -2
- package/dist/types/react/ui/metric.d.ts +2 -2
- package/dist/types/react/ui/presentation.d.ts +2 -0
- package/dist/types/react/ui/searchItems.d.ts +2 -0
- package/dist/types/react/ui/use-chart-scroll-to-end.d.ts +2 -0
- package/dist/types/react/ui/variables.d.ts +1 -1
- package/dist/types/react/view-control-bar.d.ts +18 -0
- package/dist/types/react/view-controls.d.ts +3 -2
- package/dist/types/react/view-runtime.d.ts +8 -3
- package/dist/types/react/view.d.ts +28 -7
- package/dist/types/react/widgets.d.ts +22 -11
- package/dist/types/server/local.d.ts +3 -1
- package/dist/types/server/preview/host.d.ts +1 -0
- package/dist/types/server/preview/index.d.ts +16 -0
- package/dist/types/server/reload-channel.d.ts +6 -0
- package/dist/types/server/request-body.d.ts +4 -0
- package/dist/worker.js +1 -1
- package/docs/app-authoring.md +27 -12
- package/docs/client.md +6 -7
- package/docs/composition.md +84 -0
- package/docs/contract.md +45 -26
- package/docs/data-context.md +2 -0
- package/docs/embed.md +11 -3
- package/docs/formatting-and-appearance.md +36 -5
- package/docs/layout.md +31 -8
- package/docs/react-embed.md +4 -4
- package/docs/react.md +1 -1
- package/docs/server-bun.md +25 -0
- package/docs/server.md +2 -2
- package/docs/styling.md +10 -27
- package/docs/ui.md +32 -18
- package/docs/variables.md +174 -25
- package/docs/views.md +60 -29
- package/docs/widgets.md +131 -26
- package/examples/starter-data-app/index.tsx +10 -23
- package/examples/starter-local-data-app/.bun-version +1 -0
- package/examples/starter-local-data-app/.node-version +1 -0
- package/examples/starter-local-data-app/.oxfmtrc.json +4 -0
- package/examples/starter-local-data-app/.oxlintrc.json +33 -0
- package/examples/starter-local-data-app/AGENTS.md +22 -0
- package/examples/starter-local-data-app/README.md +54 -0
- package/examples/starter-local-data-app/app.ts +28 -0
- package/examples/starter-local-data-app/bunfig.toml +2 -0
- package/examples/starter-local-data-app/package.json +33 -0
- package/examples/starter-local-data-app/src/App.tsx +8 -0
- package/examples/starter-local-data-app/src/assets.d.ts +1 -0
- package/examples/starter-local-data-app/src/data-context.ts +21 -0
- package/examples/starter-local-data-app/src/favicon.svg +13 -0
- package/examples/starter-local-data-app/src/index.html +14 -0
- package/examples/starter-local-data-app/src/main.tsx +7 -0
- package/examples/starter-local-data-app/src/operations.ts +6 -0
- package/examples/starter-local-data-app/src/server.ts +6 -0
- package/examples/starter-local-data-app/tsconfig.json +21 -0
- package/package.json +13 -3
- package/dist/chunks/index-23dktynd.js.map +0 -10
- package/dist/chunks/index-ag0cgnvq.js.map +0 -13
- package/dist/chunks/index-dq7b35fn.js +0 -307
- package/dist/chunks/index-dq7b35fn.js.map +0 -13
- package/dist/chunks/index-f5cnbrjz.js.map +0 -13
- package/dist/chunks/index-gvers8jw.js.map +0 -109
- package/dist/chunks/index-ktmvs916.js.map +0 -13
- package/dist/chunks/index-m6n8ctfc.js.map +0 -10
- package/dist/chunks/index-mev09s5v.js +0 -77
- package/dist/chunks/index-mev09s5v.js.map +0 -10
- package/dist/chunks/index-mt93ff2b.js.map +0 -10
- package/dist/chunks/index-qd5xgx6y.js.map +0 -13
- package/dist/chunks/index-x69p7cv7.js.map +0 -10
- package/dist/types/react/shellStyles.d.ts +0 -3
- package/dist/types/react/ui/DataAppSkeleton.d.ts +0 -7
- /package/dist/chunks/{index-ev2b5aaf.js.map → index-xzb7sx6g.js.map} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* TypeScript port of d3-time 3.1.0 (ISC), https://github.com/d3/d3-time/tree/v3.1.0
|
|
3
|
+
* Numeric tick-step helpers adapted from d3-array 3.2.4 (ISC).
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2010-2022 Mike Bostock (d3-time)
|
|
6
|
+
* Copyright 2010-2023 Mike Bostock (d3-array tick-step helpers)
|
|
7
|
+
*
|
|
8
|
+
* Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
9
|
+
* with or without fee is hereby granted, provided that the above copyright notice
|
|
10
|
+
* and this permission notice appear in all copies.
|
|
11
|
+
*
|
|
12
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
+
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
14
|
+
* FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
+
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
16
|
+
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
17
|
+
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
18
|
+
* THIS SOFTWARE.
|
|
19
|
+
*/
|
|
20
|
+
type DateValue = Date | number;
|
|
21
|
+
type DateMutation = (date: Date) => void;
|
|
22
|
+
type DateOffset = (date: Date, step: number) => void;
|
|
23
|
+
type DateCount = (start: Date, end: Date) => number;
|
|
24
|
+
export interface TimeInterval {
|
|
25
|
+
(date?: DateValue): Date;
|
|
26
|
+
floor(this: void, date: DateValue): Date;
|
|
27
|
+
ceil(this: void, date: DateValue): Date;
|
|
28
|
+
round(this: void, date: DateValue): Date;
|
|
29
|
+
offset(this: void, date: DateValue, step?: number): Date;
|
|
30
|
+
range(this: void, start: DateValue, stop: DateValue, step?: number): Date[];
|
|
31
|
+
filter(this: void, test: (date: Date) => boolean): TimeInterval;
|
|
32
|
+
}
|
|
33
|
+
export interface CountableTimeInterval extends TimeInterval {
|
|
34
|
+
count(this: void, start: DateValue, end: DateValue): number;
|
|
35
|
+
every(this: void, step: number): TimeInterval | null;
|
|
36
|
+
}
|
|
37
|
+
export declare function timeInterval(floor: DateMutation, offset: DateOffset): TimeInterval;
|
|
38
|
+
export declare function timeInterval(floor: DateMutation, offset: DateOffset, count: DateCount, field?: (date: Date) => number): CountableTimeInterval;
|
|
39
|
+
declare const millisecond: CountableTimeInterval;
|
|
40
|
+
declare const milliseconds: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
41
|
+
declare const second: CountableTimeInterval;
|
|
42
|
+
declare const seconds: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
43
|
+
export declare const timeMinute: CountableTimeInterval;
|
|
44
|
+
export declare const timeMinutes: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
45
|
+
export declare const utcMinute: CountableTimeInterval;
|
|
46
|
+
export declare const utcMinutes: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
47
|
+
export declare const timeHour: CountableTimeInterval;
|
|
48
|
+
export declare const timeHours: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
49
|
+
export declare const utcHour: CountableTimeInterval;
|
|
50
|
+
export declare const utcHours: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
51
|
+
export declare const timeDay: CountableTimeInterval;
|
|
52
|
+
export declare const timeDays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
53
|
+
export declare const utcDay: CountableTimeInterval;
|
|
54
|
+
export declare const utcDays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
55
|
+
export declare const unixDay: CountableTimeInterval;
|
|
56
|
+
export declare const unixDays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
57
|
+
export declare const timeSunday: CountableTimeInterval;
|
|
58
|
+
export declare const timeMonday: CountableTimeInterval;
|
|
59
|
+
export declare const timeTuesday: CountableTimeInterval;
|
|
60
|
+
export declare const timeWednesday: CountableTimeInterval;
|
|
61
|
+
export declare const timeThursday: CountableTimeInterval;
|
|
62
|
+
export declare const timeFriday: CountableTimeInterval;
|
|
63
|
+
export declare const timeSaturday: CountableTimeInterval;
|
|
64
|
+
export declare const timeSundays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
65
|
+
export declare const timeMondays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
66
|
+
export declare const timeTuesdays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
67
|
+
export declare const timeWednesdays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
68
|
+
export declare const timeThursdays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
69
|
+
export declare const timeFridays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
70
|
+
export declare const timeSaturdays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
71
|
+
export declare const utcSunday: CountableTimeInterval;
|
|
72
|
+
export declare const utcMonday: CountableTimeInterval;
|
|
73
|
+
export declare const utcTuesday: CountableTimeInterval;
|
|
74
|
+
export declare const utcWednesday: CountableTimeInterval;
|
|
75
|
+
export declare const utcThursday: CountableTimeInterval;
|
|
76
|
+
export declare const utcFriday: CountableTimeInterval;
|
|
77
|
+
export declare const utcSaturday: CountableTimeInterval;
|
|
78
|
+
export declare const utcSundays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
79
|
+
export declare const utcMondays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
80
|
+
export declare const utcTuesdays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
81
|
+
export declare const utcWednesdays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
82
|
+
export declare const utcThursdays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
83
|
+
export declare const utcFridays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
84
|
+
export declare const utcSaturdays: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
85
|
+
export declare const timeMonth: CountableTimeInterval;
|
|
86
|
+
export declare const timeMonths: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
87
|
+
export declare const utcMonth: CountableTimeInterval;
|
|
88
|
+
export declare const utcMonths: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
89
|
+
export declare const timeYear: CountableTimeInterval;
|
|
90
|
+
export declare const timeYears: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
91
|
+
export declare const utcYear: CountableTimeInterval;
|
|
92
|
+
export declare const utcYears: (this: void, start: DateValue, stop: DateValue, step?: number) => Date[];
|
|
93
|
+
declare const utcTicks: (start: DateValue, stop: DateValue, count: number | TimeInterval) => Date[], utcTickInterval: (start: DateValue, stop: DateValue, count: number) => TimeInterval | null;
|
|
94
|
+
declare const timeTicks: (start: DateValue, stop: DateValue, count: number | TimeInterval) => Date[], timeTickInterval: (start: DateValue, stop: DateValue, count: number) => TimeInterval | null;
|
|
95
|
+
export { utcTicks, utcTickInterval, timeTicks, timeTickInterval };
|
|
96
|
+
export { millisecond as timeMillisecond, millisecond as utcMillisecond, milliseconds as timeMilliseconds, milliseconds as utcMilliseconds, second as timeSecond, second as utcSecond, seconds as timeSeconds, seconds as utcSeconds, timeSunday as timeWeek, timeSundays as timeWeeks, utcSunday as utcWeek, utcSundays as utcWeeks, };
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
+
import type { IsUnion } from './queries.js';
|
|
2
|
+
import { facetSource, type FacetVariable } from './facets.js';
|
|
3
|
+
import type { SourceDimensionVariable } from './dimension-source.js';
|
|
1
4
|
import { type DatePresetId, type DateRange } from './date-range.js';
|
|
2
5
|
import type { DateRangeContract, DateRangeRequest } from './contract.js';
|
|
3
|
-
import type { DimensionSelection, DimensionVariable } from './dimension.js';
|
|
6
|
+
import type { DimensionSelection, DimensionVariable, DimensionSelectionVariable } from './dimension.js';
|
|
4
7
|
import type { NumberFilter, BooleanFilter } from './filters.js';
|
|
5
8
|
import type { HistoryMode } from './navigation.js';
|
|
6
9
|
export type { HistoryMode } from './navigation.js';
|
|
10
|
+
export type VariablePresentation = {
|
|
11
|
+
/** Scope changes the included data; display changes its presentation. Defaults to scope. */
|
|
12
|
+
group?: 'scope' | 'display';
|
|
13
|
+
/** Widget controls render beside their visualization instead of in the toolbar.
|
|
14
|
+
* Scope filters remain available in the Filters sheet and active summaries. */
|
|
15
|
+
control?: 'toolbar' | 'widget';
|
|
16
|
+
/** Secondary scope controls live in the Filters sheet with compact pickers when active; secondary display options follow primary options. Defaults to primary. */
|
|
17
|
+
prominence?: 'primary' | 'secondary';
|
|
18
|
+
};
|
|
7
19
|
/** An app-owned value with one URL representation. Controls never parse or write routes. */
|
|
8
20
|
export type AppVariable<Value, Kind extends string = string> = {
|
|
9
21
|
kind: Kind;
|
|
10
22
|
label?: string;
|
|
23
|
+
presentation?: VariablePresentation;
|
|
11
24
|
urlKeys: readonly string[];
|
|
12
25
|
defaultValue: Value;
|
|
13
26
|
/** Unrestricted value, when this variable represents a filter. */
|
|
@@ -19,10 +32,24 @@ export type AppVariable<Value, Kind extends string = string> = {
|
|
|
19
32
|
valid: (value: Value) => boolean;
|
|
20
33
|
same: (left: Value, right: Value) => boolean;
|
|
21
34
|
};
|
|
22
|
-
export type VariableCollection = Record<string, SearchVariable | ChoiceVariable | MultiChoiceVariable | DateRangeVariable | DimensionVariable<any> | NumberFilter | BooleanFilter>;
|
|
35
|
+
export type VariableCollection = Record<string, SearchVariable | ChoiceVariable<any> | MultiChoiceVariable | DateRangeVariable | DimensionVariable<any> | FacetVariable<any, any, string, unknown> | SourceDimensionVariable<any> | NumberFilter | BooleanFilter>;
|
|
23
36
|
export type AppVariableValues<Variables> = {
|
|
24
|
-
[Key in keyof Variables]: Variables[Key] extends
|
|
37
|
+
[Key in keyof Variables]: Variables[Key] extends DimensionSelectionVariable<infer Value> ? DimensionSelection<Value> : Variables[Key] extends AppVariable<infer Value, string> ? Value : never;
|
|
38
|
+
};
|
|
39
|
+
/** Keep conditional declarations narrowed so every dependency has one contract. */
|
|
40
|
+
export type CheckedVariableDeclarations<Variables extends VariableCollection> = true extends IsUnion<Variables> ? never : string extends keyof Variables ? Variables : '__proto__' extends keyof Variables ? never : {
|
|
41
|
+
[Name in keyof Variables]: true extends IsUnion<Variables[Name]> ? never : Variables[Name];
|
|
25
42
|
};
|
|
43
|
+
/** Every facet dependency must be present with a compatible variable declaration. */
|
|
44
|
+
export type CheckedFacetContexts<Variables extends VariableCollection> = CheckedVariableDeclarations<Variables> & (string extends keyof Variables ? Extract<Variables[keyof Variables], {
|
|
45
|
+
[facetSource]: unknown;
|
|
46
|
+
}> extends never ? Variables : never : {
|
|
47
|
+
[Name in keyof Variables]: Variables[Name] extends {
|
|
48
|
+
[facetSource]: {
|
|
49
|
+
context: infer Context;
|
|
50
|
+
};
|
|
51
|
+
} ? string extends keyof Context ? never : Variables extends Context ? Variables[Name] : never : Variables[Name];
|
|
52
|
+
});
|
|
26
53
|
/** Name variables once in the app. URL keys must be unique across its controls. */
|
|
27
54
|
export declare function defineAppVariables<const Variables extends VariableCollection>(variables: Variables): Variables;
|
|
28
55
|
type ScalarVariableOptions = {
|
|
@@ -30,6 +57,7 @@ type ScalarVariableOptions = {
|
|
|
30
57
|
key: string;
|
|
31
58
|
defaultValue?: string;
|
|
32
59
|
history?: HistoryMode;
|
|
60
|
+
presentation?: VariablePresentation;
|
|
33
61
|
};
|
|
34
62
|
export type SearchVariable = AppVariable<string, 'search'>;
|
|
35
63
|
export type ChoiceOption = {
|
|
@@ -37,7 +65,7 @@ export type ChoiceOption = {
|
|
|
37
65
|
label: string;
|
|
38
66
|
description?: string;
|
|
39
67
|
};
|
|
40
|
-
export type ChoiceVariable = AppVariable<
|
|
68
|
+
export type ChoiceVariable<Value extends string = string> = AppVariable<Value, 'choice'> & {
|
|
41
69
|
options: readonly ChoiceOption[];
|
|
42
70
|
};
|
|
43
71
|
export type MultiChoiceVariable = AppVariable<readonly string[], 'multiChoice'> & {
|
|
@@ -45,18 +73,24 @@ export type MultiChoiceVariable = AppVariable<readonly string[], 'multiChoice'>
|
|
|
45
73
|
maxSelected: number;
|
|
46
74
|
};
|
|
47
75
|
/** Search query state; typing replaces history by default. */
|
|
48
|
-
export declare function searchVariable({ key, label, defaultValue, history, }: ScalarVariableOptions): SearchVariable;
|
|
76
|
+
export declare function searchVariable({ key, label, defaultValue, history, }: Omit<ScalarVariableOptions, 'presentation'>): SearchVariable;
|
|
49
77
|
/** Validate labeled choices before controls or URL state consume them. */
|
|
50
78
|
export declare function validateChoiceOptions(options: readonly ChoiceOption[]): void;
|
|
51
|
-
export declare function choiceVariable({ key, label, defaultValue, options, history, }: ScalarVariableOptions & {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
79
|
+
export declare function choiceVariable<const Options extends readonly ChoiceOption[], const Presentation extends VariablePresentation | undefined = undefined>({ key, label, defaultValue, options, history, presentation, }: Omit<ScalarVariableOptions, 'presentation'> & {
|
|
80
|
+
presentation?: Presentation;
|
|
81
|
+
defaultValue: NoInfer<Options[number]['id']>;
|
|
82
|
+
options: Options & (Options extends readonly [] ? never : unknown);
|
|
83
|
+
}): ChoiceVariable<Options[number]['id']> & {
|
|
84
|
+
presentation?: Presentation;
|
|
85
|
+
};
|
|
86
|
+
export declare function multiChoiceVariable<const Options extends readonly ChoiceOption[], const Presentation extends VariablePresentation | undefined = undefined>({ key, label, defaultValue, options, maxSelected, history, presentation, }: Omit<ScalarVariableOptions, 'defaultValue' | 'presentation'> & {
|
|
87
|
+
presentation?: Presentation;
|
|
88
|
+
defaultValue?: readonly NoInfer<Options[number]['id']>[];
|
|
89
|
+
options: Options & (Options extends readonly [] ? never : unknown);
|
|
58
90
|
maxSelected?: number;
|
|
59
|
-
}): MultiChoiceVariable
|
|
91
|
+
}): MultiChoiceVariable & {
|
|
92
|
+
presentation?: Presentation;
|
|
93
|
+
};
|
|
60
94
|
export type DateRangeSelection = {
|
|
61
95
|
kind: 'preset';
|
|
62
96
|
id: DatePresetId;
|
|
@@ -78,6 +112,7 @@ export type DateRangeVariableOptions = {
|
|
|
78
112
|
history?: HistoryMode;
|
|
79
113
|
/** Opt into a URL-backed comparison with the preceding equal-length range. */
|
|
80
114
|
comparison?: boolean;
|
|
115
|
+
presentation?: VariablePresentation;
|
|
81
116
|
};
|
|
82
117
|
export type DateRangeVariable = AppVariable<DateRangeSelection, 'dateRange'> & {
|
|
83
118
|
kind: 'dateRange';
|
|
@@ -95,4 +130,4 @@ export type DateRangeVariable = AppVariable<DateRangeSelection, 'dateRange'> & {
|
|
|
95
130
|
comparisonRange: (selection: DateRangeSelection) => DateRange | null;
|
|
96
131
|
};
|
|
97
132
|
/** A date variable keeps relative presets relative and validates exact dates against source coverage. */
|
|
98
|
-
export declare function dateRangeVariable({ key, label, defaultValue, contract, history, comparison, }: DateRangeVariableOptions): DateRangeVariable;
|
|
133
|
+
export declare function dateRangeVariable({ key, label, defaultValue, contract, history, comparison, presentation, }: DateRangeVariableOptions): DateRangeVariable;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DataAppPresentation } from '../core/presentation.js';
|
|
2
2
|
import type { DataAppLogger } from '../core/logger.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type BridgeDiagnostic } from '../core/bridge.js';
|
|
4
4
|
import { type MessageDispatcher } from '../core/messages.js';
|
|
5
5
|
export type DataAppConnection = {
|
|
6
6
|
type: 'origin';
|
|
@@ -10,9 +10,9 @@ export type DataAppConnection = {
|
|
|
10
10
|
token: string;
|
|
11
11
|
};
|
|
12
12
|
export type DataAppStatus = 'connecting' | 'connected' | 'ready' | 'failed' | 'disconnected';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
/** Delivery metadata only; never tokens or payloads. `durationMs` measures host handling of a request, reported on its result or error. */
|
|
14
|
+
export type DataAppDiagnostic = BridgeDiagnostic & {
|
|
15
|
+
durationMs?: number;
|
|
16
16
|
};
|
|
17
17
|
export type DataAppHost = {
|
|
18
18
|
dispose: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Lakehouse } from '../core/contract.js';
|
|
2
2
|
import { type MessageContext, type SqlQueryInput } from '../core/messages.js';
|
|
3
3
|
/** Authorize every SQL request and supply a backend that independently enforces access and query limits. */
|
|
4
|
-
export declare function createSqlQueryHandler(authorize: (query: SqlQueryInput, context: MessageContext) => Promise<Lakehouse>): (input: SqlQueryInput, context: MessageContext) => Promise<import("../core/contract.js").QueryResult
|
|
4
|
+
export declare function createSqlQueryHandler(authorize: (query: SqlQueryInput, context: MessageContext) => Promise<Lakehouse>): (input: SqlQueryInput, context: MessageContext) => Promise<import("../core/contract.js").QueryResult<unknown[]>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Portable data app declarations; safe in browser and server modules. */
|
|
2
2
|
export { defineDataApp, dataAppTitle } from './core/config.js';
|
|
3
|
-
export type { DataAppConfig, DataAppDefinition, QueryDefinitions, QueryParameterValue, } from './core/config.js';
|
|
3
|
+
export type { DataAppConfig, DataAppDefinition, QueryDefinitions, QueryParameterValue, QueryParameter, QueryValueType, QueryField, QueryProjections, QueryRow, } from './core/config.js';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FilterTarget, BreakdownTarget } from './exploration.js';
|
|
2
|
+
import type { DetailView } from './details.js';
|
|
3
|
+
import type { ItemActions } from './ui/ExplorationActionControl.js';
|
|
4
|
+
type ActionCondition<Row> = {
|
|
5
|
+
label: string;
|
|
6
|
+
when?: (row: Row) => boolean;
|
|
7
|
+
};
|
|
8
|
+
type DetailAction<Row, Input, DestinationInput> = ActionCondition<Row> & {
|
|
9
|
+
label: string;
|
|
10
|
+
target: DetailView<any, DestinationInput>;
|
|
11
|
+
input: (row: Row, displayedInput: Input) => DestinationInput;
|
|
12
|
+
};
|
|
13
|
+
export type ActionDeclaration<Row, Input> = ActionCondition<Row> & ({
|
|
14
|
+
kind: 'detail';
|
|
15
|
+
target: DetailView<any, any>;
|
|
16
|
+
input: (row: Row, input: Input) => unknown;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'filter';
|
|
19
|
+
target: object;
|
|
20
|
+
values: (row: Row) => object;
|
|
21
|
+
breakdown?: {
|
|
22
|
+
target: BreakdownTarget<any>;
|
|
23
|
+
value: (row: Row) => string;
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
export declare class ActionBuilder<Row, Input> {
|
|
27
|
+
detail<DestinationInput>(config: DetailAction<Row, Input, DestinationInput>): ActionDeclaration<Row, Input>;
|
|
28
|
+
filter<Patch extends object, const Values extends NoInfer<Patch>, Value extends string = never>(config: ActionCondition<Row> & {
|
|
29
|
+
label: string;
|
|
30
|
+
target: FilterTarget<Patch>;
|
|
31
|
+
values: (row: Row) => Values & NoInfer<Patch>;
|
|
32
|
+
breakdown?: {
|
|
33
|
+
target: BreakdownTarget<Value>;
|
|
34
|
+
value: (row: Row) => NoInfer<Value>;
|
|
35
|
+
};
|
|
36
|
+
}): ActionDeclaration<Row, Input>;
|
|
37
|
+
}
|
|
38
|
+
declare const actionTypes: unique symbol;
|
|
39
|
+
/** Actions belong to one metric or dataset; its widget supplies displayed rows and input. */
|
|
40
|
+
export declare class ExplorationActions<Row, Input> {
|
|
41
|
+
readonly [actionTypes]: {
|
|
42
|
+
row: Row;
|
|
43
|
+
input: Input;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export declare function defineActions<Row, Input, const Actions extends Record<string, ActionDeclaration<Row, Input>>>(binding: object, build: (action: ActionBuilder<Row, Input>) => Actions, options?: {
|
|
47
|
+
primary?: keyof Actions & string;
|
|
48
|
+
}): ExplorationActions<Row, Input>;
|
|
49
|
+
export declare function resolveActions<Row, Input>(set: ExplorationActions<Row, Input> | undefined, binding: object, viewOwner: object | undefined, source: {
|
|
50
|
+
loading?: boolean;
|
|
51
|
+
input?: Input;
|
|
52
|
+
}, open: (target: DetailView<any, any>, input: unknown, trigger?: HTMLElement | SVGElement) => void): ItemActions<Row>;
|
|
53
|
+
export {};
|
|
@@ -4,6 +4,8 @@ export type AnnotationEditorState = {
|
|
|
4
4
|
target: AnnotationTargetElement;
|
|
5
5
|
draft: DataAppAnnotationDraft;
|
|
6
6
|
annotationId?: string;
|
|
7
|
+
/** Epoch milliseconds, comparable to host interaction timestamps. */
|
|
8
|
+
openedAt: number;
|
|
7
9
|
comment: string;
|
|
8
10
|
captureStatus: 'capturing' | 'ready' | 'failed';
|
|
9
11
|
error: string;
|
|
@@ -28,6 +28,7 @@ export declare function annotationPoint(rect: AnnotationRect, point?: Annotation
|
|
|
28
28
|
};
|
|
29
29
|
/** The iframe document is a crop surface, never a selectable global-layout target. */
|
|
30
30
|
export declare function annotationRoot(root: HTMLElement | null): AnnotationTargetElement | undefined;
|
|
31
|
+
export declare function indexAnnotationTargets(root: HTMLElement | null): Map<string, AnnotationTargetElement>;
|
|
31
32
|
export declare function findAnnotationTarget(root: HTMLElement | null, id: string | undefined): AnnotationTargetElement | undefined;
|
|
32
33
|
export declare function normalizeAnnotationRect(area: AnnotationRect, target: AnnotationRect): AnnotationRect;
|
|
33
34
|
export declare function projectAnnotationRect(area: AnnotationRect, target: AnnotationRect): AnnotationRect;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { WidgetEvidence } from '../ui/WidgetEvidence.js';
|
|
2
2
|
type AnnotationPropsOptions = {
|
|
3
|
-
id
|
|
3
|
+
id: string;
|
|
4
4
|
label?: string;
|
|
5
|
+
fallbackId?: string;
|
|
5
6
|
evidence?: WidgetEvidence;
|
|
6
7
|
kind?: 'widget' | 'element';
|
|
7
8
|
};
|
|
8
|
-
export declare function getAnnotationProps({ id, label, evidence, kind, }: AnnotationPropsOptions): {
|
|
9
|
-
'data-annotation-id': string
|
|
9
|
+
export declare function getAnnotationProps({ id, label, fallbackId, evidence, kind, }: AnnotationPropsOptions): {
|
|
10
|
+
'data-annotation-id': string;
|
|
11
|
+
'data-annotation-fallback-id': string | undefined;
|
|
10
12
|
'data-annotation-label': string | undefined;
|
|
11
13
|
'data-annotation-kind': "element" | "widget";
|
|
12
14
|
'data-annotation-queries': string;
|
|
@@ -13,9 +13,9 @@ type AnnotationGeometryOptions = {
|
|
|
13
13
|
rootRef: AnnotationRootRef;
|
|
14
14
|
target?: AnnotationTargetElement;
|
|
15
15
|
region?: AnnotationRect;
|
|
16
|
-
|
|
16
|
+
annotations: DataAppAnnotationPresentation['targets'];
|
|
17
17
|
};
|
|
18
|
-
export declare function useAnnotationGeometry({ rootRef, target, region,
|
|
18
|
+
export declare function useAnnotationGeometry({ rootRef, target, region, annotations, }: AnnotationGeometryOptions): {
|
|
19
19
|
pins: AnnotationPin[];
|
|
20
20
|
outline?: AnnotationRect;
|
|
21
21
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { type DetailNavigation } from './details.js';
|
|
2
|
+
import { type ActionBuilder, type ExplorationActions, type ActionDeclaration } from './actions.js';
|
|
1
3
|
import type { EvidenceDeclaration } from './ui/data-context.js';
|
|
2
|
-
import type {
|
|
4
|
+
import type { SearchSuggestion } from './ui/SearchTypeahead.js';
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
|
+
import type { DateFormat } from '../core/format.js';
|
|
3
7
|
import type { DateRangeRequest } from '../core/contract.js';
|
|
4
8
|
import type { DataView, DisplayedSnapshot } from '../core/data-view.js';
|
|
5
9
|
import type { MetricFormat } from '../core/format.js';
|
|
@@ -9,6 +13,7 @@ import type { MetricDefinition } from './ui/metric.js';
|
|
|
9
13
|
import type { EmptyContent } from './ui/presentation.js';
|
|
10
14
|
import type { TableWidgetColumn } from './ui/TableWidget.js';
|
|
11
15
|
import type { WidgetEvidence } from './ui/WidgetEvidence.js';
|
|
16
|
+
import { DetailView } from './details.js';
|
|
12
17
|
/** Displayed data, or an initial loading reading. Pending filter values are never a source. */
|
|
13
18
|
export type ViewSource<Data, Input> = {
|
|
14
19
|
loading: true;
|
|
@@ -34,6 +39,16 @@ export type DatasetColumn<Row> = {
|
|
|
34
39
|
} | {
|
|
35
40
|
value: (row: Row) => number | null | undefined;
|
|
36
41
|
format: MetricFormat;
|
|
42
|
+
} | {
|
|
43
|
+
value: (row: Row) => string | number | null | undefined;
|
|
44
|
+
format: Extract<DateFormat, {
|
|
45
|
+
kind: 'dateTime';
|
|
46
|
+
}>;
|
|
47
|
+
} | {
|
|
48
|
+
value: (row: Row) => string | null | undefined;
|
|
49
|
+
format: Extract<DateFormat, {
|
|
50
|
+
kind: 'date';
|
|
51
|
+
}>;
|
|
37
52
|
});
|
|
38
53
|
export type DatasetDefinition<Data, Input, Row, Evidence = WidgetEvidence> = {
|
|
39
54
|
name: string;
|
|
@@ -42,6 +57,14 @@ export type DatasetDefinition<Data, Input, Row, Evidence = WidgetEvidence> = {
|
|
|
42
57
|
rowKey: (row: NoInfer<Row>) => string | number;
|
|
43
58
|
evidence: Evidence;
|
|
44
59
|
emptyFallback?: EmptyContent;
|
|
60
|
+
/** Declare for records whose titles are useful query completions; omit for aggregate rows. */
|
|
61
|
+
suggestions?: DatasetSuggestionOptions<Row>;
|
|
62
|
+
};
|
|
63
|
+
export type DatasetSuggestionOptions<Row> = {
|
|
64
|
+
title: (row: Row) => string;
|
|
65
|
+
description?: (row: Row) => string;
|
|
66
|
+
/** Override query completion with an app action. */
|
|
67
|
+
onSelect?: (row: Row) => void;
|
|
45
68
|
};
|
|
46
69
|
/** Authoring references are registered by the owning view. */
|
|
47
70
|
export type DatasetDeclaration<Data, Input, Row> = DatasetDefinition<Data, Input, Row, EvidenceDeclaration>;
|
|
@@ -49,6 +72,8 @@ export type DatasetDeclaration<Data, Input, Row> = DatasetDefinition<Data, Input
|
|
|
49
72
|
export declare class RegisteredBinding {
|
|
50
73
|
#private;
|
|
51
74
|
constructor(owner?: object, evidence?: WidgetEvidence);
|
|
75
|
+
/** @internal */
|
|
76
|
+
static owner(binding: RegisteredBinding): object | undefined;
|
|
52
77
|
protected assertSource(source: object): void;
|
|
53
78
|
static evidence(binding: RegisteredBinding, owner: object): WidgetEvidence;
|
|
54
79
|
}
|
|
@@ -56,13 +81,19 @@ export declare function registeredEvidence(binding: RegisteredBinding, owner: ob
|
|
|
56
81
|
export declare class ExportDataset<Data, Input> extends RegisteredBinding {
|
|
57
82
|
#private;
|
|
58
83
|
readonly name: string;
|
|
84
|
+
/** @internal Undefined means this dataset declares no record suggestions. */
|
|
85
|
+
readSearchSuggestions(_source: ViewSource<Data, Input>): DataReading<readonly SearchSuggestion[]> | undefined;
|
|
59
86
|
constructor(name: string, csv: (snapshot: DisplayedSnapshot<Data, Input>) => CsvTable, owner?: object, evidence?: WidgetEvidence);
|
|
60
87
|
static csv<Data, Input>(dataset: ExportDataset<Data, Input>, snapshot: DisplayedSnapshot<Data, Input>): CsvTable;
|
|
61
88
|
}
|
|
62
89
|
export declare class Dataset<Data, Input, Row> extends ExportDataset<Data, Input> {
|
|
63
90
|
#private;
|
|
64
91
|
readonly evidence: WidgetEvidence;
|
|
65
|
-
constructor(definition: DatasetDefinition<Data, Input, Row>, owner?: object);
|
|
92
|
+
constructor(definition: DatasetDefinition<Data, Input, Row>, owner?: object, timeZone?: string);
|
|
93
|
+
actions<const Actions extends Record<string, ActionDeclaration<Row, Input>>>(build: (action: ActionBuilder<Row, Input>) => Actions, options?: {
|
|
94
|
+
primary?: keyof Actions & string;
|
|
95
|
+
}): ExplorationActions<Row, Input>;
|
|
96
|
+
readSearchSuggestions(source: ViewSource<Data, Input>): DataReading<readonly SearchSuggestion[]> | undefined;
|
|
66
97
|
read: <Source extends ViewSource<Data, Input>>(source: Source) => SourceReading<Source, readonly Row[]>;
|
|
67
98
|
static table<Data, Input, Row>(dataset: Dataset<Data, Input, Row>, source: ViewSource<Data, Input>): {
|
|
68
99
|
title: string;
|
|
@@ -78,7 +109,7 @@ export declare class Dataset<Data, Input, Row> extends ExportDataset<Data, Input
|
|
|
78
109
|
};
|
|
79
110
|
};
|
|
80
111
|
}
|
|
81
|
-
export declare function bindDataset<Data, Input, Row>(definition: DatasetDefinition<Data, Input, Row>, owner?: object): Dataset<Data, Input, Row>;
|
|
112
|
+
export declare function bindDataset<Data, Input, Row>(definition: DatasetDefinition<Data, Input, Row>, owner?: object, timeZone?: string): Dataset<Data, Input, Row>;
|
|
82
113
|
export declare function datasetTable<Data, Input, Row>(dataset: Dataset<Data, Input, Row>, source: ViewSource<Data, Input>): {
|
|
83
114
|
title: string;
|
|
84
115
|
columns: [TableWidgetColumn<Row>, ...TableWidgetColumn<Row>[]];
|
|
@@ -100,6 +131,34 @@ export declare class Metric<Data, Input> extends RegisteredBinding {
|
|
|
100
131
|
read: <Source extends ViewSource<Data, Input>>(source: Source) => SourceReading<Source, MetricValues & {
|
|
101
132
|
period?: DateRangeRequest;
|
|
102
133
|
}>;
|
|
134
|
+
records<DetailData, DetailInput>(options: {
|
|
135
|
+
target: DetailView<DetailData, DetailInput>;
|
|
136
|
+
input: (displayedInput: Input) => DetailInput;
|
|
137
|
+
}): MetricRecords<Data, Input, DetailData, DetailInput>;
|
|
138
|
+
actions<const Actions extends Record<string, ActionDeclaration<void, Input>>>(build: (action: ActionBuilder<void, Input>) => Actions, options?: {
|
|
139
|
+
primary?: keyof Actions & string;
|
|
140
|
+
}): ExplorationActions<void, Input>;
|
|
141
|
+
}
|
|
142
|
+
/** A metric-owned record destination. It can only render from that metric's displayed source. */
|
|
143
|
+
export declare class MetricRecords<Data, Input, DetailData, DetailInput> {
|
|
144
|
+
#private;
|
|
145
|
+
constructor(metric: Metric<Data, Input>, target: DetailView<DetailData, DetailInput>, input: (displayedInput: Input) => DetailInput);
|
|
146
|
+
render(source: ViewSource<Data, Input>, navigation?: DetailNavigation): {
|
|
147
|
+
scope: string;
|
|
148
|
+
content: import("react").FunctionComponentElement<{
|
|
149
|
+
content: import("./details.js").DetailContent<any, any>;
|
|
150
|
+
input: any;
|
|
151
|
+
navigation?: DetailNavigation;
|
|
152
|
+
}>;
|
|
153
|
+
} | undefined;
|
|
154
|
+
static render<Data, Input, DetailData, DetailInput>(records: MetricRecords<Data, Input, DetailData, DetailInput>, metric: Metric<Data, Input>, source: ViewSource<Data, Input>, navigation?: DetailNavigation): {
|
|
155
|
+
scope: string;
|
|
156
|
+
content: import("react").FunctionComponentElement<{
|
|
157
|
+
content: import("./details.js").DetailContent<any, any>;
|
|
158
|
+
input: any;
|
|
159
|
+
navigation?: DetailNavigation;
|
|
160
|
+
}>;
|
|
161
|
+
} | undefined;
|
|
103
162
|
}
|
|
104
163
|
export declare function bindMetric<Data, Input>(definition: MetricDefinition, select: (data: Data, input: Input) => MetricValues, date?: (input: Input) => DateRangeRequest, owner?: object): Metric<Data, Input>;
|
|
105
164
|
export declare function displayedScope<Data, Input>(view: DataView<Data, Input>, describeInput: (input: Input) => string): DataReading<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The reporting zone belongs to the displayed view, not the browser. */
|
|
2
|
+
export declare const DateFormattingContext: import("react").Context<{
|
|
3
|
+
timeZone?: string;
|
|
4
|
+
}>;
|
|
5
|
+
/** Resolve date display defaults for custom charts and narrative. Explicit options override the view and app. */
|
|
6
|
+
export declare function useDateFormatting(options?: {
|
|
7
|
+
locale?: string;
|
|
8
|
+
timeZone?: string;
|
|
9
|
+
}): {
|
|
10
|
+
locale: string;
|
|
11
|
+
timeZone: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { EmptyContent } from './ui/presentation.js';
|
|
3
|
+
import type { ViewSource } from './bindings.js';
|
|
4
|
+
import type { ViewResult } from './view-runtime.js';
|
|
5
|
+
export type DetailViewDefinition<Data, Input> = {
|
|
6
|
+
id: string;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
/** Validates untrusted navigation input before a detail operation can run. */
|
|
9
|
+
parseInput: (input: unknown) => Input;
|
|
10
|
+
describeInput: (input: Input) => string;
|
|
11
|
+
isEmpty: (data: Data) => boolean;
|
|
12
|
+
emptyFallback: EmptyContent;
|
|
13
|
+
};
|
|
14
|
+
/** A typed, query-backed destination. */
|
|
15
|
+
export declare class DetailView<Data, Input> {
|
|
16
|
+
#private;
|
|
17
|
+
readonly definition: DetailViewDefinition<Data, Input>;
|
|
18
|
+
readonly useResult: (input: Input) => ViewResult<Data, Input>;
|
|
19
|
+
constructor(definition: DetailViewDefinition<Data, Input>, useResult: (input: Input) => ViewResult<Data, Input>);
|
|
20
|
+
content(render: (source: ViewSource<Data, Input>) => ReactNode): DetailContent<Data, Input>;
|
|
21
|
+
static content<Data, Input>(target: DetailView<Data, Input>): DetailContent<Data, Input>;
|
|
22
|
+
}
|
|
23
|
+
/** Validate destination input before it enters either navigation or a lazy records query. */
|
|
24
|
+
export declare function parseDetailInput<Data, Input>(target: DetailView<Data, Input>, value: unknown): Input;
|
|
25
|
+
/** A destination’s rendered body. Pass these to DataApp.details. */
|
|
26
|
+
export declare class DetailContent<Data, Input> {
|
|
27
|
+
readonly target: DetailView<Data, Input>;
|
|
28
|
+
readonly render: (source: ViewSource<Data, Input>) => ReactNode;
|
|
29
|
+
constructor(target: DetailView<Data, Input>, render: (source: ViewSource<Data, Input>) => ReactNode);
|
|
30
|
+
}
|
|
31
|
+
export type DetailNavigation = {
|
|
32
|
+
open<Data, Input>(target: DetailView<Data, Input>, input: Input, trigger?: HTMLElement | SVGElement | null): void;
|
|
33
|
+
};
|
|
34
|
+
/** Resolve a detail target from an interaction. The destination validates input before fetching. */
|
|
35
|
+
export declare function useDetailNavigation(): DetailNavigation;
|
|
36
|
+
/** Mounts one replacement sheet for a stack of detail destinations. */
|
|
37
|
+
export declare function DetailRoutes({ details, children, }: {
|
|
38
|
+
details: readonly DetailContent<any, any>[];
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}): import("react").JSX.Element;
|
|
41
|
+
/** Render a destination in an inspection tab. The query starts only when that tab mounts. */
|
|
42
|
+
export declare function DetailRecords({ content, input, navigation, }: {
|
|
43
|
+
content: DetailContent<any, any>;
|
|
44
|
+
input: any;
|
|
45
|
+
navigation?: DetailNavigation;
|
|
46
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DateRangeRequest } from '../core/contract.js';
|
|
2
|
+
import type { AppVariableValues, VariableCollection } from '../core/variables.js';
|
|
3
|
+
import type { ChoiceVariable } from '../core/variables.js';
|
|
4
|
+
import { type ViewBindings } from './view.js';
|
|
5
|
+
declare const filterPatch: unique symbol;
|
|
6
|
+
declare const breakdownValue: unique symbol;
|
|
7
|
+
export declare class FilterTarget<Patch> {
|
|
8
|
+
readonly [filterPatch]: Patch;
|
|
9
|
+
}
|
|
10
|
+
export declare class BreakdownTarget<Value extends string> {
|
|
11
|
+
readonly [breakdownValue]: Value;
|
|
12
|
+
}
|
|
13
|
+
export type FilterPatch<Variables extends VariableCollection> = Partial<{
|
|
14
|
+
[Key in keyof Variables]: Extract<Variables[Key]['presentation'], {
|
|
15
|
+
group: 'display';
|
|
16
|
+
}> extends never ? AppVariableValues<Variables>[Key] : never;
|
|
17
|
+
}>;
|
|
18
|
+
type TargetDefinition = {
|
|
19
|
+
owner: object;
|
|
20
|
+
variables: VariableCollection;
|
|
21
|
+
input: (values: any) => unknown;
|
|
22
|
+
bindings?: ViewBindings<any, any>;
|
|
23
|
+
date?: {
|
|
24
|
+
variable: string;
|
|
25
|
+
input: (input: any) => DateRangeRequest;
|
|
26
|
+
};
|
|
27
|
+
key?: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function createFilterTarget<Variables extends VariableCollection>(definition: TargetDefinition): FilterTarget<FilterPatch<Variables>>;
|
|
30
|
+
export declare function createBreakdownTarget<Value extends string>(definition: TargetDefinition): BreakdownTarget<Value>;
|
|
31
|
+
export declare function breakdownDefinition(target: BreakdownTarget<any>): TargetDefinition;
|
|
32
|
+
export declare function targetAvailable(target: object, displayedInput: unknown, owner: object): boolean;
|
|
33
|
+
/** Apply an explicit scope patch and optional chart choice in one history entry. */
|
|
34
|
+
export declare function applyFilter(target: object, patch: Record<string, unknown>, breakdown?: {
|
|
35
|
+
target: BreakdownTarget<any>;
|
|
36
|
+
value: string;
|
|
37
|
+
}): void;
|
|
38
|
+
export declare function breakdownState(target: BreakdownTarget<any>, owner: object | undefined, input?: unknown): {
|
|
39
|
+
variable: ChoiceVariable;
|
|
40
|
+
value: string;
|
|
41
|
+
options: readonly import("../core/variables.js").ChoiceOption[];
|
|
42
|
+
set(id: string): void;
|
|
43
|
+
};
|
|
44
|
+
export {};
|