@altertable/data-app-react 0.0.0-stage → 0.71.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.
Files changed (169) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -2
  3. package/THIRD_PARTY_NOTICES +18 -0
  4. package/dist/chunks/index-1nbjx0se.js +17022 -0
  5. package/dist/chunks/index-1nbjx0se.js.map +120 -0
  6. package/dist/index.js +2888 -0
  7. package/dist/index.js.map +23 -0
  8. package/dist/types/actions.d.ts +53 -0
  9. package/dist/types/annotations/AnnotationBar.d.ts +30 -0
  10. package/dist/types/annotations/AnnotationControls.d.ts +10 -0
  11. package/dist/types/annotations/AnnotationEditor.d.ts +16 -0
  12. package/dist/types/annotations/AnnotationMarkers.d.ts +19 -0
  13. package/dist/types/annotations/AnnotationSelectionLayer.d.ts +12 -0
  14. package/dist/types/annotations/AnnotationTarget.d.ts +9 -0
  15. package/dist/types/annotations/AnnotationTooltip.d.ts +9 -0
  16. package/dist/types/annotations/AnnotationTrigger.d.ts +10 -0
  17. package/dist/types/annotations/annotation-editor-state.d.ts +58 -0
  18. package/dist/types/annotations/annotation-screenshot.d.ts +4 -0
  19. package/dist/types/annotations/annotation-targets.d.ts +34 -0
  20. package/dist/types/annotations/getAnnotationProps.d.ts +17 -0
  21. package/dist/types/annotations/styles.d.ts +3 -0
  22. package/dist/types/annotations/useAnnotationGeometry.d.ts +22 -0
  23. package/dist/types/annotations/useDataAppAnnotations.d.ts +22 -0
  24. package/dist/types/app-context.d.ts +3 -0
  25. package/dist/types/bindings.d.ts +169 -0
  26. package/dist/types/content.d.ts +36 -0
  27. package/dist/types/date-formatting.d.ts +12 -0
  28. package/dist/types/details.d.ts +46 -0
  29. package/dist/types/exploration.d.ts +44 -0
  30. package/dist/types/hooks.d.ts +114 -0
  31. package/dist/types/index.d.ts +78 -0
  32. package/dist/types/injectStyles.d.ts +7 -0
  33. package/dist/types/mount.d.ts +13 -0
  34. package/dist/types/search-suggestions.d.ts +8 -0
  35. package/dist/types/source-owner.d.ts +2 -0
  36. package/dist/types/style-contract.d.ts +88 -0
  37. package/dist/types/style-validation.d.ts +2 -0
  38. package/dist/types/styles.d.ts +8 -0
  39. package/dist/types/ui/AboutData.d.ts +73 -0
  40. package/dist/types/ui/AltertableLogo.d.ts +3 -0
  41. package/dist/types/ui/AppFooter.d.ts +6 -0
  42. package/dist/types/ui/AppHeader.d.ts +10 -0
  43. package/dist/types/ui/AppLayout.d.ts +10 -0
  44. package/dist/types/ui/AppScope.d.ts +7 -0
  45. package/dist/types/ui/AppToolbar.d.ts +30 -0
  46. package/dist/types/ui/AreaChart.d.ts +7 -0
  47. package/dist/types/ui/BarChart.d.ts +6 -0
  48. package/dist/types/ui/Breakdown.d.ts +13 -0
  49. package/dist/types/ui/Button.d.ts +12 -0
  50. package/dist/types/ui/ChartLegend.d.ts +32 -0
  51. package/dist/types/ui/Checkbox.d.ts +21 -0
  52. package/dist/types/ui/CheckboxGroup.d.ts +7 -0
  53. package/dist/types/ui/ChoicePicker.d.ts +39 -0
  54. package/dist/types/ui/Comparison.d.ts +14 -0
  55. package/dist/types/ui/ComposedChart.d.ts +41 -0
  56. package/dist/types/ui/ComposedChartLegend.d.ts +9 -0
  57. package/dist/types/ui/ContentSkeleton.d.ts +7 -0
  58. package/dist/types/ui/DataApp.d.ts +24 -0
  59. package/dist/types/ui/DataAppFrame.d.ts +52 -0
  60. package/dist/types/ui/DataBoundary.d.ts +14 -0
  61. package/dist/types/ui/DataSection.d.ts +14 -0
  62. package/dist/types/ui/DataSectionBoundary.d.ts +30 -0
  63. package/dist/types/ui/DataTable.d.ts +29 -0
  64. package/dist/types/ui/DataValue.d.ts +9 -0
  65. package/dist/types/ui/DataViewToast.d.ts +11 -0
  66. package/dist/types/ui/DataWidget.d.ts +37 -0
  67. package/dist/types/ui/DateDisplay.d.ts +9 -0
  68. package/dist/types/ui/DateRangePicker.d.ts +30 -0
  69. package/dist/types/ui/DateTimeTooltip.d.ts +10 -0
  70. package/dist/types/ui/DimensionPicker.d.ts +14 -0
  71. package/dist/types/ui/EmptyState.d.ts +6 -0
  72. package/dist/types/ui/ExplorationActionControl.d.ts +60 -0
  73. package/dist/types/ui/ExportControl.d.ts +4 -0
  74. package/dist/types/ui/FilterActions.d.ts +10 -0
  75. package/dist/types/ui/FilterBar.d.ts +3 -0
  76. package/dist/types/ui/FunnelChart.d.ts +20 -0
  77. package/dist/types/ui/GettingStarted.d.ts +6 -0
  78. package/dist/types/ui/GlossaryDefinition.d.ts +7 -0
  79. package/dist/types/ui/GlossaryExplanation.d.ts +16 -0
  80. package/dist/types/ui/GradientScroll.d.ts +23 -0
  81. package/dist/types/ui/Grid.d.ts +12 -0
  82. package/dist/types/ui/GridItem.d.ts +7 -0
  83. package/dist/types/ui/HelpPopover.d.ts +21 -0
  84. package/dist/types/ui/IconButton.d.ts +19 -0
  85. package/dist/types/ui/InspectionContext.d.ts +12 -0
  86. package/dist/types/ui/InspectionProvider.d.ts +29 -0
  87. package/dist/types/ui/JourneyChart.d.ts +10 -0
  88. package/dist/types/ui/Kbd.d.ts +7 -0
  89. package/dist/types/ui/LineChart.d.ts +7 -0
  90. package/dist/types/ui/LiveControl.d.ts +10 -0
  91. package/dist/types/ui/Menu.d.ts +13 -0
  92. package/dist/types/ui/MetricWidget.d.ts +51 -0
  93. package/dist/types/ui/NumberField.d.ts +27 -0
  94. package/dist/types/ui/NumberFilterPicker.d.ts +11 -0
  95. package/dist/types/ui/PeriodSummary.d.ts +17 -0
  96. package/dist/types/ui/PickerField.d.ts +23 -0
  97. package/dist/types/ui/PieChart.d.ts +11 -0
  98. package/dist/types/ui/PopoverSurface.d.ts +5 -0
  99. package/dist/types/ui/PresentStory.d.ts +30 -0
  100. package/dist/types/ui/QueryList.d.ts +14 -0
  101. package/dist/types/ui/RadioGroup.d.ts +18 -0
  102. package/dist/types/ui/Ranking.d.ts +13 -0
  103. package/dist/types/ui/RefreshControl.d.ts +9 -0
  104. package/dist/types/ui/RequestHint.d.ts +20 -0
  105. package/dist/types/ui/RetentionChart.d.ts +27 -0
  106. package/dist/types/ui/ScatterChart.d.ts +17 -0
  107. package/dist/types/ui/SearchField.d.ts +23 -0
  108. package/dist/types/ui/SearchInput.d.ts +10 -0
  109. package/dist/types/ui/SearchMatch.d.ts +6 -0
  110. package/dist/types/ui/SearchTypeahead.d.ts +15 -0
  111. package/dist/types/ui/SectionHeading.d.ts +8 -0
  112. package/dist/types/ui/Select.d.ts +22 -0
  113. package/dist/types/ui/SelectionMark.d.ts +5 -0
  114. package/dist/types/ui/Sheet.d.ts +21 -0
  115. package/dist/types/ui/Skeleton.d.ts +8 -0
  116. package/dist/types/ui/Stack.d.ts +7 -0
  117. package/dist/types/ui/StaticDataApp.d.ts +4 -0
  118. package/dist/types/ui/StatusPanel.d.ts +10 -0
  119. package/dist/types/ui/TableWidget.d.ts +67 -0
  120. package/dist/types/ui/Tabs.d.ts +10 -0
  121. package/dist/types/ui/TextContent.d.ts +4 -0
  122. package/dist/types/ui/TextWidget.d.ts +20 -0
  123. package/dist/types/ui/ThemeSelector.d.ts +12 -0
  124. package/dist/types/ui/Toast.d.ts +8 -0
  125. package/dist/types/ui/Tooltip.d.ts +23 -0
  126. package/dist/types/ui/TooltipSurface.d.ts +3 -0
  127. package/dist/types/ui/TrendChart.d.ts +5 -0
  128. package/dist/types/ui/UpdatedAt.d.ts +9 -0
  129. package/dist/types/ui/VariableBar.d.ts +6 -0
  130. package/dist/types/ui/VisualizationWidget.d.ts +43 -0
  131. package/dist/types/ui/WidgetDisclosure.d.ts +6 -0
  132. package/dist/types/ui/WidgetEvidence.d.ts +12 -0
  133. package/dist/types/ui/WidgetViewTabs.d.ts +16 -0
  134. package/dist/types/ui/chart-data.d.ts +36 -0
  135. package/dist/types/ui/chart-date-axis.d.ts +15 -0
  136. package/dist/types/ui/chart-interaction.d.ts +27 -0
  137. package/dist/types/ui/chart-primitives.d.ts +22 -0
  138. package/dist/types/ui/chart-time.d.ts +19 -0
  139. package/dist/types/ui/chartColor.d.ts +2 -0
  140. package/dist/types/ui/classNames.d.ts +1 -0
  141. package/dist/types/ui/csv-export.d.ts +19 -0
  142. package/dist/types/ui/data-context.d.ts +76 -0
  143. package/dist/types/ui/data-identifiers.d.ts +32 -0
  144. package/dist/types/ui/icons.d.ts +49 -0
  145. package/dist/types/ui/index.d.ts +111 -0
  146. package/dist/types/ui/journey-flow.d.ts +49 -0
  147. package/dist/types/ui/keyboard.d.ts +6 -0
  148. package/dist/types/ui/metric-comparison.d.ts +30 -0
  149. package/dist/types/ui/metric.d.ts +11 -0
  150. package/dist/types/ui/presentation.d.ts +25 -0
  151. package/dist/types/ui/search.d.ts +6 -0
  152. package/dist/types/ui/searchItems.d.ts +36 -0
  153. package/dist/types/ui/shortcuts.d.ts +45 -0
  154. package/dist/types/ui/story.d.ts +20 -0
  155. package/dist/types/ui/time-interval.d.ts +96 -0
  156. package/dist/types/ui/use-chart-scroll-to-end.d.ts +2 -0
  157. package/dist/types/ui/useAppAppearance.d.ts +3 -0
  158. package/dist/types/ui/useDataAppPresentation.d.ts +3 -0
  159. package/dist/types/ui/useSvgId.d.ts +2 -0
  160. package/dist/types/ui/variables.d.ts +36 -0
  161. package/dist/types/ui/widget-views.d.ts +3 -0
  162. package/dist/types/view-control-bar.d.ts +18 -0
  163. package/dist/types/view-controls.d.ts +20 -0
  164. package/dist/types/view-runtime.d.ts +34 -0
  165. package/dist/types/view.d.ts +87 -0
  166. package/dist/types/widgets.d.ts +90 -0
  167. package/dist/ui/index.js +3520 -0
  168. package/dist/ui/index.js.map +36 -0
  169. package/package.json +65 -4
@@ -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, };
@@ -0,0 +1,2 @@
1
+ /** Keep the latest supplied samples visible when the displayed items change. */
2
+ export declare function useChartScrollToEnd(items: readonly unknown[]): import("react").RefObject<HTMLDivElement | null>;
@@ -0,0 +1,3 @@
1
+ import { type Theme, type AppearanceOptions } from '@altertable/data-app/appearance';
2
+ /** The parent theme takes precedence; only standalone viewers receive controls. */
3
+ export declare function useAppAppearance(appearance: AppearanceOptions | undefined, hostTheme?: Theme): import("@altertable/data-app/appearance").ThemeController | undefined;
@@ -0,0 +1,3 @@
1
+ import { type DataAppPresentation } from '@altertable/data-app/internal';
2
+ /** Local preview verifies its parent before accepting presentation context. */
3
+ export declare function useDataAppPresentation(): DataAppPresentation | undefined;
@@ -0,0 +1,2 @@
1
+ /** Stable React ID for SVG definitions and their URL references; safe with identifier prefixes. */
2
+ export declare function useSvgId(): string;
@@ -0,0 +1,36 @@
1
+ import { type DatePresetId, type DateRange, type AppVariableValues, type DateRangeSelection, type DateRangeVariable, type HistoryMode, type VariableCollection } from '@altertable/data-app/internal';
2
+ export { defineAppVariables, searchVariable, choiceVariable, multiChoiceVariable, dateRangeVariable, type VariablePresentation, type AppVariable, type AppVariableValues, type ChoiceOption, type ChoiceVariable, type MultiChoiceVariable, type SearchVariable, type DateRangeSelection, type DateRangeVariable, type DateRangeVariableOptions, type VariableCollection, } from '@altertable/data-app/internal';
3
+ /** Adapt one date variable to the controlled picker without giving the picker URL ownership. */
4
+ export declare function dateRangeControl(variable: DateRangeVariable, selection: DateRangeSelection, onChange: (selection: DateRangeSelection) => void): {
5
+ minDate?: string;
6
+ maxDate: string;
7
+ maxRangeDays: number;
8
+ timeZone: string;
9
+ value: DateRange;
10
+ label: string | undefined;
11
+ onChange(range: DateRange | null): void;
12
+ onPresetChange(id: DatePresetId): void;
13
+ selectedPresetId: DatePresetId | null;
14
+ onReset(): void;
15
+ isDefault: boolean;
16
+ resetValue: DateRange;
17
+ comparison?: {
18
+ enabled: boolean;
19
+ range: DateRange | null;
20
+ onChange(enabled: boolean): void;
21
+ } | undefined;
22
+ };
23
+ /** URL is the source of truth for app variables; one update can change dependent values atomically. */
24
+ export declare function useAppVariables<const Variables extends VariableCollection>(definitions: Variables): {
25
+ values: AppVariableValues<Variables>;
26
+ set: <Key extends keyof Variables & string>(name: Key, value: AppVariableValues<Variables>[Key]) => void;
27
+ reset: <Key extends keyof Variables & string>(name: Key) => void;
28
+ resetAll: () => void;
29
+ clearAll: () => void;
30
+ update: (next: Partial<AppVariableValues<Variables>>, history?: HistoryMode) => void;
31
+ bind: <Key extends keyof Variables & string>(name: Key) => {
32
+ value: AppVariableValues<Variables>[Key];
33
+ onChange(value: AppVariableValues<Variables>[Key]): void;
34
+ resetValue: AppVariableValues<Variables>[Key];
35
+ };
36
+ };
@@ -0,0 +1,3 @@
1
+ export declare function validateWidgetViews(views: readonly {
2
+ id: string;
3
+ }[], selected: string): void;
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from 'react';
2
+ export type ActiveFilterControl = {
3
+ id: string;
4
+ label: string;
5
+ summary: string;
6
+ onRemove: () => void;
7
+ /** Render the editor and notify when it clears its own active filter. */
8
+ renderToolbarControl?: (onClear: () => void) => ReactNode;
9
+ };
10
+ export declare function ViewControlBar({ primaryFilters, activeFilters, allFilters, activeFilterCount, displayOptions, changedDisplayOptionCount, onClear, }: {
11
+ primaryFilters: ReactNode[];
12
+ allFilters: ReactNode[];
13
+ activeFilters: ActiveFilterControl[];
14
+ activeFilterCount: number;
15
+ displayOptions: ReactNode[];
16
+ changedDisplayOptionCount: number;
17
+ onClear?: () => void;
18
+ }): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type AppVariableValues, type VariableCollection } from './ui/variables.js';
3
+ import type { ResolvedVariables } from './view.js';
4
+ /** URL values resolve before facets; facet keys include their dependent inputs for cached, bounded loading. */
5
+ export declare function useViewVariables<Variables extends VariableCollection>(definitions: Variables, clientScope: string, loadFacet: (operation: string, input: unknown, signal: AbortSignal) => Promise<unknown>): {
6
+ values: AppVariableValues<Variables>;
7
+ set: <Key extends keyof Variables & string>(name: Key, value: AppVariableValues<Variables>[Key]) => void;
8
+ reset: <Key extends keyof Variables & string>(name: Key) => void;
9
+ resetAll: () => void;
10
+ clearAll: () => void;
11
+ update: (next: Partial<AppVariableValues<Variables>>, history?: import("@altertable/data-app/internal").HistoryMode) => void;
12
+ bind: <Key extends keyof Variables & string>(name: Key) => {
13
+ value: AppVariableValues<Variables>[Key];
14
+ onChange(value: AppVariableValues<Variables>[Key]): void;
15
+ resetValue: AppVariableValues<Variables>[Key];
16
+ };
17
+ resolved: ResolvedVariables<Variables>;
18
+ searchControls: ReactNode[] | null;
19
+ filterControls: import("react").JSX.Element | null;
20
+ };
@@ -0,0 +1,34 @@
1
+ import { type DataContext } from './ui/data-context.js';
2
+ import { type ReactNode } from 'react';
3
+ import { type DataView, type DisplayedSnapshot } from '@altertable/data-app/internal';
4
+ import { type DisclosedQuery } from '@altertable/data-app/contract';
5
+ import { type EmptyContent } from './ui/presentation.js';
6
+ export type ViewResult<Data, Input> = {
7
+ dataContext: DataContext;
8
+ timeZone?: string;
9
+ view: DataView<Data, Input>;
10
+ snapshot?: DisplayedSnapshot<Data, Input>;
11
+ refetch: () => unknown;
12
+ cancel: () => unknown;
13
+ refreshing: boolean;
14
+ queries?: DisclosedQuery[];
15
+ searchControls?: ReactNode;
16
+ filterControls?: ReactNode;
17
+ emptyFallback: EmptyContent;
18
+ };
19
+ /** The executor is private; declarations expose data composition, not subscription hooks. */
20
+ export declare class DeclaredView<Data, Input, Definition = unknown> {
21
+ #private;
22
+ constructor(useResult: () => ViewResult<Data, Input>, definition?: Definition);
23
+ static definition<Data, Input, Definition>(view: DeclaredView<Data, Input, Definition>): Definition;
24
+ static useResult<View extends DeclaredView<unknown, unknown>>(view: View): DeclaredViewResult<View>;
25
+ }
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>;
29
+ export declare const PrimaryViewContext: import("react").Context<{
30
+ declaration: object;
31
+ result: ViewResult<unknown, unknown>;
32
+ } | null>;
33
+ export declare function getViewDefinition<Data, Input, Definition>(view: DeclaredView<Data, Input, Definition>): Definition;
34
+ export {};
@@ -0,0 +1,87 @@
1
+ import type { DataContext } from './ui/data-context.js';
2
+ import type { EmptyContent } from './ui/presentation.js';
3
+ import type { AppVariableValues, DateRangeVariable, VariableCollection, CheckedFacetContexts } from '@altertable/data-app/internal';
4
+ import type { DateRangeRequest } from '@altertable/data-app/contract';
5
+ type ResolvedVariable<Variable> = Variable extends DateRangeVariable ? DateRangeRequest : AppVariableValues<{
6
+ value: Variable;
7
+ }>['value'];
8
+ export type ResolvedVariables<Variables extends VariableCollection> = {
9
+ [Key in keyof Variables]: ResolvedVariable<Variables[Key]> | (string extends keyof Variables ? undefined : never);
10
+ };
11
+ type DateVariableKey<Variables extends VariableCollection> = {
12
+ [Key in keyof Variables]: Variables[Key] extends DateRangeVariable ? Key : never;
13
+ }[keyof Variables] & string;
14
+ export type ViewDate<Variables extends VariableCollection, Input> = {
15
+ variable: DateVariableKey<Variables>;
16
+ /** Extract the selected range and comparison unchanged, including from nested inputs. */
17
+ input: (input: Input) => DateRangeRequest;
18
+ };
19
+ /** Read variable values from a custom operation input; omitted keys use top-level fields. */
20
+ export type ViewBindings<Variables extends VariableCollection, Input> = Partial<{
21
+ [Key in keyof Variables]: (input: Input) => ResolvedVariables<Variables>[Key];
22
+ }>;
23
+ type RequiredFilterBindingKeys<Variables extends VariableCollection, Input> = {
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;
27
+ }[keyof Variables];
28
+ /** Derive compatible top-level filter bindings; require readers for other input shapes. */
29
+ export type ViewBindingOptions<Variables extends VariableCollection, Input, AdditionalRequired extends keyof Variables = never> = [RequiredFilterBindingKeys<Variables, Input> | AdditionalRequired] extends [
30
+ never
31
+ ] ? {
32
+ bindings?: ViewBindings<Variables, Input>;
33
+ } : {
34
+ bindings: ViewBindings<Variables, Input> & {
35
+ [Key in RequiredFilterBindingKeys<Variables, Input> | AdditionalRequired]-?: (input: Input) => ResolvedVariables<Variables>[Key];
36
+ };
37
+ };
38
+ type SameViewInput<Variables extends VariableCollection, Input> = [
39
+ ResolvedVariables<Variables>
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;
45
+ type ViewInputMapping<Variables extends VariableCollection, Input> = SameViewInput<Variables, Input> extends true ? {
46
+ input?: (values: ResolvedVariables<Variables>) => Input;
47
+ } : {
48
+ input: (values: ResolvedVariables<Variables>) => Input;
49
+ };
50
+ export type DataViewDefinition<Name extends string, Variables extends VariableCollection, Input, Data> = {
51
+ operation: Name;
52
+ dataContext: DataContext;
53
+ /** App-owned semantics: measured zero need not mean an empty result. */
54
+ isEmpty: (data: Data) => boolean;
55
+ /** Inherited by DataSection unless it supplies its own copy. */
56
+ emptyFallback: EmptyContent;
57
+ } & (keyof Variables extends never ? {
58
+ variables?: Variables & CheckedFacetContexts<NoInfer<Variables>>;
59
+ } : {
60
+ variables: Variables & CheckedFacetContexts<NoInfer<Variables>>;
61
+ }) & ViewInputMapping<NoInfer<Variables>, Input> & ViewBindingOptions<NoInfer<Variables>, Input> & ({
62
+ date: ViewDate<Variables, Input>;
63
+ describeInput?: (input: Input) => string;
64
+ } | {
65
+ date?: never;
66
+ describeInput: (input: Input) => string;
67
+ });
68
+ export type ResolvedDataViewDefinition<Name extends string, Variables extends VariableCollection, Input, Data> = Omit<DataViewDefinition<Name, Variables, Input, Data>, 'variables' | 'input'> & {
69
+ variables: Variables;
70
+ input: (values: ResolvedVariables<Variables>) => Input;
71
+ };
72
+ export declare function describeViewInput<Input>(definition: {
73
+ variables: VariableCollection;
74
+ bindings?: Partial<Record<string, (input: Input) => unknown>>;
75
+ date?: {
76
+ variable: string;
77
+ input: (input: Input) => DateRangeRequest;
78
+ };
79
+ describeInput?: (input: Input) => string;
80
+ }): (input: Input) => string;
81
+ export declare function resolveViewInput<Variables extends VariableCollection, Input>(definition: {
82
+ input: (values: ResolvedVariables<Variables>) => Input;
83
+ date?: ViewDate<Variables, Input>;
84
+ variables: Variables;
85
+ bindings?: ViewBindings<Variables, Input>;
86
+ }, values: ResolvedVariables<Variables>): Input;
87
+ export {};
@@ -0,0 +1,90 @@
1
+ import { type ExplorationActions } from './actions.js';
2
+ import { type BreakdownTarget } from './exploration.js';
3
+ import { type ItemActions } from './ui/ExplorationActionControl.js';
4
+ import { type Dataset, type Metric, type ViewSource } from './bindings.js';
5
+ import { type MetricWidgetProps as DisplayMetricProps } from './ui/MetricWidget.js';
6
+ import { type TableWidgetProps as DisplayTableProps, type TableDisplayMode } from './ui/TableWidget.js';
7
+ import { type VisualizationWidgetProps as DisplayVisualProps, type VisualizationWidgetView as DisplayVisualizationView } from './ui/VisualizationWidget.js';
8
+ import { type TextWidgetProps as DisplayTextProps } from './ui/TextWidget.js';
9
+ import { type DataValueProps as DisplayValueProps } from './ui/DataValue.js';
10
+ import type { MetricValues } from '@altertable/data-app/internal';
11
+ import type { MetricDefinition } from './ui/metric.js';
12
+ import type { ReactNode } from 'react';
13
+ import type { DataReading } from '@altertable/data-app/internal';
14
+ import { MetricRecords } from './bindings.js';
15
+ export type MetricWidgetProps<Data = unknown, Input = unknown> = Omit<Extract<DisplayMetricProps, {
16
+ metric: MetricDefinition;
17
+ }>, 'metric' | 'reading' | 'records'> & {
18
+ metric: Metric<Data, Input>;
19
+ source: ViewSource<NoInfer<Data>, NoInfer<Input>>;
20
+ records?: MetricRecords<Data, Input, any, any>;
21
+ actions?: ExplorationActions<void, NoInfer<Input>>;
22
+ };
23
+ export declare function MetricWidget<Data, Input>({ metric, source, records, actions, action, ...presentation }: MetricWidgetProps<Data, Input>): import("react").JSX.Element;
24
+ type BoundTableProps<Row> = Extract<DisplayTableProps<Row>, {
25
+ reading: DataReading<readonly Row[]>;
26
+ }>;
27
+ type TablePresentation<Row> = Pick<BoundTableProps<Row>, 'title' | 'columns' | 'rowKey' | 'reading' | 'evidence' | 'emptyFallback'>;
28
+ export type TableWidgetProps<Row, Data = unknown, Input = unknown> = Omit<BoundTableProps<Row>, keyof TablePresentation<Row> | 'limit' | 'pagination'> & TableDisplayMode & {
29
+ dataset: Dataset<Data, Input, Row>;
30
+ source: ViewSource<NoInfer<Data>, NoInfer<Input>>;
31
+ title?: ReactNode;
32
+ actions?: ExplorationActions<NoInfer<Row>, NoInfer<Input>>;
33
+ };
34
+ export declare function TableWidget<Row, Data, Input>({ dataset, source, title, actions, ...presentation }: TableWidgetProps<Row, Data, Input>): import("react").JSX.Element;
35
+ type BoundVisual<Row> = Extract<DisplayVisualProps<readonly Row[]>, {
36
+ reading: DataReading<readonly Row[]>;
37
+ }>;
38
+ export type VisualizationWidgetView<Row> = Omit<DisplayVisualizationView<readonly Row[]>, 'render'> & {
39
+ render: (rows: readonly Row[], actions: ItemActions<Row>) => ReactNode;
40
+ };
41
+ type VisualContent<Row> = {
42
+ children: (rows: readonly Row[], actions: ItemActions<Row>) => ReactNode;
43
+ views?: never;
44
+ viewLabel?: never;
45
+ initialView?: never;
46
+ } | {
47
+ children?: never;
48
+ views: readonly VisualizationWidgetView<Row>[];
49
+ viewLabel: string;
50
+ initialView?: string;
51
+ };
52
+ export type VisualizationWidgetProps<Row, Data = unknown, Input = unknown> = Omit<BoundVisual<Row>, 'reading' | 'isEmpty' | 'emptyFallback' | 'evidence' | 'title' | 'children' | 'views' | 'viewLabel' | 'initialView'> & VisualContent<Row> & {
53
+ dataset: Dataset<Data, Input, Row>;
54
+ source: ViewSource<NoInfer<Data>, NoInfer<Input>>;
55
+ title?: ReactNode;
56
+ actions?: ExplorationActions<NoInfer<Row>, NoInfer<Input>>;
57
+ breakdown?: BreakdownTarget<any>;
58
+ };
59
+ export declare function VisualizationWidget<Row, Data, Input>({ dataset, source, title, actions, breakdown, children, views, viewLabel, initialView, ...presentation }: VisualizationWidgetProps<Row, Data, Input>): import("react").JSX.Element;
60
+ type NarrativeBinding<Data, Input, Row> = {
61
+ metric: Metric<Data, Input>;
62
+ dataset?: never;
63
+ source: ViewSource<NoInfer<Data>, NoInfer<Input>>;
64
+ children?: (values: MetricValues) => ReactNode;
65
+ } | {
66
+ metric?: never;
67
+ dataset: Dataset<Data, Input, Row>;
68
+ source: ViewSource<NoInfer<Data>, NoInfer<Input>>;
69
+ children: (rows: readonly Row[]) => ReactNode;
70
+ };
71
+ export type TextWidgetProps<Data = unknown, Input = unknown, Row = never> = Omit<Extract<DisplayTextProps<unknown>, {
72
+ reading: DataReading<unknown>;
73
+ }>, 'reading' | 'evidence' | 'children' | 'title' | 'emptyFallback'> & NarrativeBinding<Data, Input, Row> & {
74
+ title?: ReactNode;
75
+ };
76
+ export declare function TextWidget<Data, Input, Row>(props: TextWidgetProps<Data, Input, Row>): import("react").JSX.Element;
77
+ type InlinePresentation = Omit<DisplayValueProps<unknown>, 'reading' | 'children' | 'loadingFallback'> & {
78
+ loadingFallback?: ReactNode;
79
+ };
80
+ export type DataValueProps<Data = unknown, Input = unknown, Row = never> = InlinePresentation & ((NarrativeBinding<Data, Input, Row> & {
81
+ scope?: never;
82
+ }) | {
83
+ metric?: never;
84
+ dataset?: never;
85
+ source?: never;
86
+ scope: DataReading<string>;
87
+ children?: (scope: string) => ReactNode;
88
+ });
89
+ export declare function DataValue<Data, Input, Row>(props: DataValueProps<Data, Input, Row>): import("react").JSX.Element;
90
+ export {};