@altertable/data-app 0.75.0 → 0.76.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 (38) hide show
  1. package/README.md +56 -9
  2. package/REFERENCE.md +25 -79
  3. package/dist/chunks/{contract-B3s0ybE2.js → contract-DsyRYgN_.js} +6 -83
  4. package/dist/chunks/contract-DsyRYgN_.js.map +1 -0
  5. package/dist/chunks/{contract-DcPjfm0R.js → contract-kNFYPHRK.js} +3 -3
  6. package/dist/chunks/{contract-DcPjfm0R.js.map → contract-kNFYPHRK.js.map} +1 -1
  7. package/dist/chunks/{format-5hMYUWk3.js → date-time-range-value-TE8KCsfV.js} +2 -147
  8. package/dist/chunks/date-time-range-value-TE8KCsfV.js.map +1 -0
  9. package/dist/chunks/{diagnostics-DVwQ5PDK.js → diagnostics-DhCqGklq.js} +2 -2
  10. package/dist/chunks/{diagnostics-DVwQ5PDK.js.map → diagnostics-DhCqGklq.js.map} +1 -1
  11. package/dist/chunks/{operation-CGuN7Zcb.js → operation-7tiT4cpJ.js} +3 -3
  12. package/dist/chunks/{operation-CGuN7Zcb.js.map → operation-7tiT4cpJ.js.map} +1 -1
  13. package/dist/client/index.js +4 -4
  14. package/dist/core/config.js +1 -1
  15. package/dist/core/contract.js +4 -4
  16. package/dist/core/format.js +149 -1
  17. package/dist/core/format.js.map +1 -0
  18. package/dist/internal.js +6 -190
  19. package/dist/internal.js.map +1 -1
  20. package/dist/server/index.js +3 -3
  21. package/dist/types/chunks/contract.d.ts +6 -295
  22. package/dist/types/chunks/contract2.d.ts +207 -0
  23. package/dist/types/chunks/date-time-range-value.d.ts +2 -28
  24. package/dist/types/chunks/date-time-range.d.ts +29 -0
  25. package/dist/types/chunks/index.d.ts +2 -1
  26. package/dist/types/client/index.d.ts +1 -1
  27. package/dist/types/core/config.d.ts +2 -2
  28. package/dist/types/core/contract.d.ts +5 -3
  29. package/dist/types/core/format.d.ts +2 -1
  30. package/dist/types/index.d.ts +2 -2
  31. package/dist/types/internal.d.ts +6 -4
  32. package/dist/types/server/index.d.ts +1 -1
  33. package/docs/contract.md +3 -2
  34. package/docs/ui.md +1 -1
  35. package/docs/variables.md +22 -11
  36. package/package.json +16 -5
  37. package/dist/chunks/contract-B3s0ybE2.js.map +0 -1
  38. package/dist/chunks/format-5hMYUWk3.js.map +0 -1
package/README.md CHANGED
@@ -1,17 +1,34 @@
1
1
  # @altertable/data-app
2
2
 
3
- Portable definitions, contracts, formatting, browser clients, and request handlers
4
- for Altertable data apps.
3
+ The SDK behind [Altertable data apps](https://altertable.ai/docs/data-apps):
4
+ interactive apps that agents build over your data. Queries are declared up front,
5
+ so every result stays governed, cacheable, and traceable to its source while the
6
+ interface adapts to each question.
7
+
8
+ ## Do you need this package?
9
+
10
+ - **Building an app in Altertable, Slack, or an MCP client:** follow
11
+ [Build a data app](https://altertable.ai/docs/data-apps/build). The agent uses
12
+ this SDK for you; no install is needed.
13
+ - **Developing locally:** scaffold, run, and publish with the Altertable CLI
14
+ (`altertable app create`). See
15
+ [local development](https://altertable.ai/docs/data-apps/local-development).
16
+ - **Writing an app by hand or embedding apps in a product:** install the packages
17
+ below.
5
18
 
6
19
  ## Installation
7
20
 
8
21
  ```fish
9
22
  bun add @altertable/data-app
23
+ # or
24
+ npm install @altertable/data-app
25
+ # or
26
+ pnpm add @altertable/data-app
10
27
  ```
11
28
 
12
29
  ## Usage
13
30
 
14
- Declare an app's identity and query registry:
31
+ Declare an app's identity and its named queries:
15
32
 
16
33
  ```ts
17
34
  import { defineDataApp } from '@altertable/data-app';
@@ -20,18 +37,48 @@ const dataApp = defineDataApp({
20
37
  title: 'Activity',
21
38
  description: 'Explore activity across your organization.',
22
39
  scope: { organization: 'demo', environment: 'production' },
23
- queries: {},
40
+ queries: {
41
+ eventsByDay: {
42
+ statement: `
43
+ SELECT CAST(date_trunc('day', occurred_at) AS VARCHAR) AS day, count(*) AS events
44
+ FROM events
45
+ WHERE occurred_at >= $period.from AND occurred_at < $period.to
46
+ GROUP BY day ORDER BY day`,
47
+ params: { period: { type: 'dateTimeRange' } },
48
+ projections: {
49
+ day: { type: 'string' },
50
+ events: { type: 'number' },
51
+ },
52
+ },
53
+ },
24
54
  });
25
55
  ```
26
56
 
27
- Use `/contract` for operations and validation, `/client` for browser requests,
28
- and `/server` for request handling. Add `@altertable/data-app-react` to build app
29
- UI or `@altertable/data-app-embed` to host an app. This package requires no React.
57
+ See [queries and operations](docs/contract.md) to run them.
58
+
59
+ ## Packages
60
+
61
+ Add the packages your app needs:
62
+
63
+ | Package | Use it to |
64
+ | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
65
+ | `@altertable/data-app` | Define apps and queries (`/contract`, `/client`, `/server`) |
66
+ | [`@altertable/data-app-react`](https://www.npmjs.com/package/@altertable/data-app-react) | Build app UI with views, filters, charts, and tables |
67
+ | [`@altertable/data-app-embed`](https://www.npmjs.com/package/@altertable/data-app-embed) | Host apps in your product through an iframe sandbox |
68
+ | [`@altertable/data-app-bun`](https://www.npmjs.com/package/@altertable/data-app-bun) | Serve and preview apps locally against your lakehouse |
69
+ | [`@altertable/data-app-worker`](https://www.npmjs.com/package/@altertable/data-app-worker) | Serve apps from a self-contained sandbox Worker |
70
+ | [`@altertable/data-app-manifest`](https://www.npmjs.com/package/@altertable/data-app-manifest) | Extract and rewrite manifests in build tooling |
71
+ | [`@altertable/data-app-examples`](https://www.npmjs.com/package/@altertable/data-app-examples) | Start from canonical app templates |
30
72
 
31
73
  ## Documentation
32
74
 
33
- Start with [app authoring](docs/app-authoring.md). Guides, [agent instructions](AGENTS.md),
34
- and the [API reference](REFERENCE.md) ship with this package.
75
+ - [Data apps documentation](https://altertable.ai/docs/data-apps): build, share,
76
+ and develop apps in Altertable.
77
+ - [Interfaces for the next question](https://altertable.ai/blog/2026-11-04-interfaces-for-the-next-question):
78
+ why data apps exist and how they are designed.
79
+ - [App authoring](docs/app-authoring.md): start here to write an app. Guides,
80
+ [agent instructions](AGENTS.md), and the [API reference](REFERENCE.md) ship with
81
+ this package.
35
82
 
36
83
  ## License
37
84
 
package/REFERENCE.md CHANGED
@@ -108,10 +108,13 @@ AreaChart.itemActions?: ItemActions<Row> — Actions available for each displaye
108
108
  AreaChart.unit: string
109
109
  AreaChart.ariaLabel: string
110
110
  AreaChart.formatValue?: ((value: number) => string)
111
+ AreaChart.horizontalGrid?: boolean — Draw horizontal grid lines behind the plotted values.
112
+ AreaChart.cursorGroup?: ChartCursorGroup — Share mouse-hover timestamps with charts receiving the same handle. Matches each item's time exactly.
111
113
  AreaChartItem (type, @altertable/data-app-react/ui)
112
114
  AreaChartItem.id: string
113
115
  AreaChartItem.label: string
114
116
  AreaChartItem.value: number
117
+ AreaChartItem.time?: number — Optional timestamp in epoch milliseconds for cursor linking. Omit for category samples.
115
118
  AreaChartProps (type, @altertable/data-app-react/ui): <Row> = props listed as AreaChart.*
116
119
  BarChart (component, @altertable/data-app-react/ui): <Row extends BarChartItem>(props: BarChartProps<Row>) — Nonnegative category values. Compose inside VisualizationWidget for a titled panel. Owns hover/touch tooltips; no selection state or keyboard navigation.
117
120
  BarChart.items: readonly Row[] — Ordered samples; the chart validates IDs and values when rendering.
@@ -119,10 +122,13 @@ BarChart.itemActions?: ItemActions<Row> — Actions available for each displayed
119
122
  BarChart.unit: string
120
123
  BarChart.ariaLabel: string
121
124
  BarChart.formatValue?: ((value: number) => string)
125
+ BarChart.horizontalGrid?: boolean — Draw horizontal grid lines behind the plotted values.
126
+ BarChart.cursorGroup?: ChartCursorGroup — Share mouse-hover timestamps with charts receiving the same handle. Matches each item's time exactly.
122
127
  BarChartItem (type, @altertable/data-app-react/ui)
123
128
  BarChartItem.id: string
124
129
  BarChartItem.label: string
125
130
  BarChartItem.value: number
131
+ BarChartItem.time?: number — Milliseconds since the Unix epoch. Enables adaptive time ticks when no item actions are supplied.
126
132
  BarChartProps (type, @altertable/data-app-react/ui): <Row> = props listed as BarChart.*
127
133
  booleanFilter (function, @altertable/data-app/contract): (options: FilterOptions<BooleanSelection>): BooleanFilter — Boolean predicate with a distinct unrestricted state.
128
134
  booleanFilter.options.key: string
@@ -152,6 +158,7 @@ Button.size?: 'compact' | 'default' | 'icon' | 'icon-compact'
152
158
  Button.…: plus props inherited from React
153
159
  ButtonProps (type, @altertable/data-app-react): = props listed as Button.*
154
160
  chartColor (function, @altertable/data-app-react): (id: string): string
161
+ ChartCursorGroup (type, @altertable/data-app-react/ui): Opaque shared-cursor handle. Create with useChartCursorGroup and pass through chart cursorGroup props.
155
162
  ChartLegend (component, @altertable/data-app-react/ui): (props: ChartLegendProps)
156
163
  ChartLegend.children: ReactNode
157
164
  ChartLegend.layout?: 'horizontal' | 'single-row' | 'vertical' — Single-row fits up to four cells before expansion, adapting to available width.
@@ -244,9 +251,11 @@ Comparison.favorableDirection?: 'down' | 'up' [variant 2 of 2]
244
251
  Comparison.label: string [variant 2 of 2]
245
252
  ComparisonProps (type, @altertable/data-app-react): = props listed as Comparison.*
246
253
  ComposedChart (component, @altertable/data-app-react/ui): <Row>(props: ComposedChartProps<Row>) — Shared themed series and controls; other children retain native Recharts defaults.
254
+ ComposedChart.horizontalGrid?: boolean — Draw horizontal grid lines behind the plotted values.
247
255
  ComposedChart.data: readonly Row[] — Displayed rows; series and axes select fields with Recharts dataKey props.
248
256
  ComposedChart.ariaLabel: string — Describes the measures and scope for assistive technology.
249
257
  ComposedChart.valueFormat?: MetricFormat — Shared measure semantics: compact numeric axes and precise tooltips. For mixed units, use explicit axis tickFormatter and series/tooltip formatters.
258
+ ComposedChart.cursorGroup?: ChartCursorGroup — Share mouse-hover timestamps with charts receiving the same handle, using the temporal X axis.
250
259
  ComposedChart.…: plus props inherited from recharts
251
260
  ComposedChart.Dot: (props: DotProps & { active?: boolean; })
252
261
  ComposedChart.Area: <Row = unknown, Value = number | null>(props: AreaProps<Row, Value>)
@@ -358,7 +367,7 @@ DataAppProvider (component, @altertable/data-app-react/ui): <const Queries exten
358
367
  DataAppProvider.app: DataAppDefinition<Queries>
359
368
  DataAppProvider.children: ReactNode
360
369
  DataAppStyle (type, @altertable/data-app-react, @altertable/data-app-react/ui): React style properties with checked public Altertable custom properties.
361
- DataAppStyle.{--atbl-accent, --atbl-accent-subtle, --atbl-annotation-accent, --atbl-annotation-accent-hover, --atbl-annotation-highlight, --atbl-annotation-on-accent, --atbl-backdrop, --atbl-background, --atbl-border, --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-chart-fill, --atbl-code-keyword, --atbl-code-surface, --atbl-code-text, --atbl-content-width, --atbl-control-compact-height, --atbl-control-disabled-opacity, --atbl-control-gap, --atbl-control-height, --atbl-control-hover-border, --atbl-control-hover-surface, --atbl-control-icon-size, --atbl-control-open-border, --atbl-control-open-surface, --atbl-control-padding-block, --atbl-control-padding-inline, --atbl-control-pressed-surface, --atbl-control-selected-surface, --atbl-control-selected-text, --atbl-control-text-size, --atbl-cursor-action, --atbl-cursor-busy, --atbl-cursor-disabled, --atbl-cursor-help, --atbl-danger, --atbl-danger-subtle, --atbl-dropdown-item-gap, --atbl-dropdown-item-padding-block, --atbl-dropdown-item-padding-inline, --atbl-dropdown-padding, --atbl-duration-fast, --atbl-duration-normal, --atbl-duration-slow, --atbl-ease-enter, --atbl-ease-standard, --atbl-focus-color, --atbl-focus-outline, --atbl-focus-ring-inset, --atbl-focus-ring-offset, --atbl-font, --atbl-font-heading, --atbl-layout-gap, --atbl-mono-font, --atbl-muted, --atbl-negative, --atbl-on-accent, --atbl-positive, --atbl-radius-control, --atbl-radius-overlay, --atbl-radius-surface, --atbl-shadow-control, --atbl-shadow-overlay, --atbl-shadow-surface, --atbl-space-lg, --atbl-space-md, --atbl-space-sm, --atbl-space-xl, --atbl-space-xs, --atbl-subtle, --atbl-surface, --atbl-surface-padding, --atbl-text, --atbl-text-measure, --atbl-type-body-leading, --atbl-type-body-size, --atbl-type-emphasis-weight, --atbl-type-heading-leading, --atbl-type-heading-weight, --atbl-type-label-leading, --atbl-type-label-size, --atbl-type-label-weight, --atbl-type-meta-size, --atbl-type-meta-weight, --atbl-type-metric-leading, --atbl-type-metric-size, --atbl-type-page-size, --atbl-type-section-size, --atbl-type-widget-size}?: string | number
370
+ DataAppStyle.{--atbl-accent, --atbl-annotation-accent, --atbl-annotation-accent-hover, --atbl-annotation-highlight, --atbl-annotation-on-accent, --atbl-backdrop, --atbl-background, --atbl-border, --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-chart-fill, --atbl-code-keyword, --atbl-code-surface, --atbl-code-text, --atbl-content-width, --atbl-control-compact-height, --atbl-control-disabled-opacity, --atbl-control-gap, --atbl-control-height, --atbl-control-hover-border, --atbl-control-hover-surface, --atbl-control-icon-size, --atbl-control-open-border, --atbl-control-open-surface, --atbl-control-padding-block, --atbl-control-padding-inline, --atbl-control-pressed-surface, --atbl-control-selected-surface, --atbl-control-selected-text, --atbl-control-text-size, --atbl-cursor-action, --atbl-cursor-busy, --atbl-cursor-disabled, --atbl-cursor-help, --atbl-danger, --atbl-danger-subtle, --atbl-dropdown-item-gap, --atbl-dropdown-item-padding-block, --atbl-dropdown-item-padding-inline, --atbl-dropdown-padding, --atbl-duration-fast, --atbl-duration-normal, --atbl-duration-slow, --atbl-ease-enter, --atbl-ease-standard, --atbl-focus-color, --atbl-focus-outline, --atbl-focus-ring-inset, --atbl-focus-ring-offset, --atbl-font, --atbl-font-heading, --atbl-layout-gap, --atbl-mono-font, --atbl-muted, --atbl-negative, --atbl-on-accent, --atbl-positive, --atbl-radius-control, --atbl-radius-overlay, --atbl-radius-surface, --atbl-shadow-control, --atbl-shadow-overlay, --atbl-shadow-surface, --atbl-space-lg, --atbl-space-md, --atbl-space-sm, --atbl-space-xl, --atbl-space-xs, --atbl-subtle, --atbl-surface, --atbl-surface-padding, --atbl-text, --atbl-text-measure, --atbl-type-body-leading, --atbl-type-body-size, --atbl-type-emphasis-weight, --atbl-type-heading-leading, --atbl-type-heading-weight, --atbl-type-label-leading, --atbl-type-label-size, --atbl-type-label-weight, --atbl-type-meta-size, --atbl-type-meta-weight, --atbl-type-metric-leading, --atbl-type-metric-size, --atbl-type-page-size, --atbl-type-section-size, --atbl-type-widget-size}?: string | number
362
371
  DataAppStyle.…: plus props inherited from csstype
363
372
  DataAppStyleHooks (type, @altertable/data-app-react, @altertable/data-app-react/ui)
364
373
  DataAppStyleHooks.data-atbl-focus?: 'group' | 'inset' | 'ring'
@@ -366,7 +375,7 @@ DataAppStyleHooks.data-atbl-control?: 'action' | 'default' | 'help' | 'text'
366
375
  DataAppStylesOptions (type, @altertable/data-app-react)
367
376
  DataAppStylesOptions.document?: Document — Defaults to the current browser document.
368
377
  DataAppStylesOptions.nonce?: string — Nonce permitted by the document's style-src CSP.
369
- DataAppStyleToken (type, @altertable/data-app-react, @altertable/data-app-react/ui): = '--atbl-accent' | '--atbl-accent-subtle' | '--atbl-annotation-accent' | '--atbl-annotation-accent-hover' | '--atbl-annotation-highlight' | '--atbl-annotation-on-accent' | ... 88 more ... | '--atbl-type-widget-size'
378
+ DataAppStyleToken (type, @altertable/data-app-react, @altertable/data-app-react/ui): = '--atbl-accent' | '--atbl-annotation-accent' | '--atbl-annotation-accent-hover' | '--atbl-annotation-highlight' | '--atbl-annotation-on-accent' | '--atbl-backdrop' | '--atbl-background' | ... 86 more ... | '--atbl-type-widget-size'
370
379
  DataClient (type, @altertable/data-app/client): <Operations> = props listed as createDataHooks.client.*
371
380
  DataClientOptions (type, @altertable/data-app/client): <Operations> = props listed as createDataClient.options.* — Browser operations and named-operation delivery are mutually exclusive.
372
381
  DataContext (type, @altertable/data-app-react)
@@ -508,77 +517,10 @@ DateFormat.precision?: 'minute' | 'second' [variant 2 of 2]
508
517
  DateFormatOptions (type, @altertable/data-app/format): Formatting for calendar dates and instants without implicit time-zone parsing.
509
518
  DateFormatOptions.locale?: string
510
519
  DateFormatOptions.missing?: string
511
- DatePresetId (type, @altertable/data-app-react/ui): = 'day' | 'last-14' | 'last-3' | 'last-30' | 'last-7' | 'last-90' | 'previous-month' | 'previous-week' | 'this-month' | 'this-week'
512
- DateRange (type, @altertable/data-app-react/ui): = props listed as previousDateRange.options.* — ISO calendar dates; the app operation defines timezone and inclusive bounds.
513
520
  DateRangeContract (type, @altertable/data-app/contract)
514
521
  DateRangeContract.datetime: { timeZone: string; bounds: (now?: Date | undefined) => { minDate: string | undefined; maxDate: string; maxRangeDays: number; timeZone: string; }; parse: (value: unknown, now?: Date | undefined) => DateTimeRange; resolve: (value: unknown, now?: Date | undefined) => ResolvedDateTimeRange; comparison…
515
- DateRangeContract.request: (value: unknown, compare?: boolean | undefined) => DateRangeRequest
516
- DateRangeContract.parseRequest: (value: unknown) => DateRangeRequest
517
522
  DateRangeContract.bounds: (now?: Date | undefined) => { minDate: string | undefined; maxDate: string; maxRangeDays: number; timeZone: string; }
518
- DateRangeContract.parse: (value: unknown) => DateRange
519
- DateRangeContract.period: ({ start, end }: DateRange) => ReportingPeriod
520
- DateRangeContract.comparison: (input: DateRange) => DateRange | null
521
- DateRangeContract.describeInput: (input: DateRange) => string
522
- DateRangeContract.view: { period: ({ start, end }: DateRange) => ReportingPeriod; describeInput: (input: DateRange) => string; }
523
523
  DateRangeContractOptions (type, @altertable/data-app/contract): = props listed as defineDateRangeContract.options.*
524
- DateRangeInput (type, @altertable/data-app/contract): = props listed as previousDateRange.options.* — ISO calendar dates; the app operation defines timezone and inclusive bounds.
525
- DateRangePicker (component, @altertable/data-app-react/ui): (props: DateRangePickerProps) — The app owns URL state; `dateRangeControl` binds a date variable to this picker.
526
- DateRangePicker.label?: string
527
- DateRangePicker.labelPlacement?: 'above' | 'beside'
528
- DateRangePicker.value: DateRange | null
529
- DateRangePicker.onChange: (range: DateRange | null) => void
530
- DateRangePicker.minDate?: string
531
- DateRangePicker.maxDate?: string
532
- DateRangePicker.maxRangeDays?: number
533
- DateRangePicker.timeZone?: string
534
- DateRangePicker.resetValue?: DateRange — Used to display the reset affordance. The app variable owns the URL and reset meaning.
535
- DateRangePicker.isDefault?: boolean
536
- DateRangePicker.onReset?: (() => void)
537
- DateRangePicker.onPresetChange?: ((id: DatePresetId) => void)
538
- DateRangePicker.selectedPresetId?: DatePresetId | null
539
- DateRangePicker.calendarFooter?: ReactNode
540
- DateRangePicker.comparison?: { enabled: boolean; range: DateRange | null; onChange: (enabled: boolean) => void; }
541
- DateRangePicker.…: plus props inherited from @react-types/shared, React, react-aria-components, react-stately
542
- DateRangePickerProps (type, @altertable/data-app-react/ui): = props listed as DateRangePicker.*
543
- DateRangeRequest (type, @altertable/data-app/contract)
544
- DateRangeRequest.range: DateRange
545
- DateRangeRequest.comparison: DateRange | null
546
- DateRangeSelection (type, @altertable/data-app-react)
547
- DateRangeSelection.kind: 'preset' [variant 1 of 2]
548
- DateRangeSelection.id: DatePresetId [variant 1 of 2]
549
- DateRangeSelection.comparison?: 'previous'
550
- DateRangeSelection.kind: 'dates' [variant 2 of 2]
551
- DateRangeSelection.start: string [variant 2 of 2]
552
- DateRangeSelection.end: string [variant 2 of 2]
553
- dateRangeVariable (function, @altertable/data-app-react): (options: DateRangeVariableOptions): DateRangeVariable — A date variable keeps relative presets relative and validates exact dates against source coverage.
554
- dateRangeVariable.options.label?: string
555
- dateRangeVariable.options.key: string — URL key for a relative preset; explicit dates use start/end for period, otherwise key-prefixed fields.
556
- dateRangeVariable.options.defaultValue: DateRangeSelection & { comparison?: undefined; }
557
- dateRangeVariable.options.contract: { datetime: { timeZone: string; bounds: (now?: Date | undefined) => { minDate: string | undefined; maxDate: string; maxRangeDays: number; timeZone: string; }; parse: (value: unknown, now?: Date | undefined) => DateTimeRange; resolve: (value: unknown, now?: Date | undefined) => ResolvedDateTimeRange…
558
- dateRangeVariable.options.history?: HistoryMode
559
- dateRangeVariable.options.comparison?: boolean — Opt into a URL-backed comparison with the preceding equal-length range.
560
- dateRangeVariable.options.presentation?: VariablePresentation
561
- DateRangeVariable (type, @altertable/data-app-react)
562
- DateRangeVariable.kind: 'dateRange'
563
- DateRangeVariable.label?: string
564
- DateRangeVariable.presentation?: VariablePresentation
565
- DateRangeVariable.urlKeys: readonly string[]
566
- DateRangeVariable.defaultValue: DateRangeSelection
567
- DateRangeVariable.clearValue?: DateRangeSelection — Unrestricted value, when this variable represents a filter.
568
- DateRangeVariable.describe?: ((value: DateRangeSelection) => string)
569
- DateRangeVariable.history: HistoryMode
570
- DateRangeVariable.read: (params: URLSearchParams) => DateRangeSelection
571
- DateRangeVariable.write: (value: DateRangeSelection) => Record<string, string | null>
572
- DateRangeVariable.valid: (value: DateRangeSelection) => boolean
573
- DateRangeVariable.same: (left: DateRangeSelection, right: DateRangeSelection) => boolean
574
- DateRangeVariable.supportsComparison: boolean
575
- DateRangeVariable.input: (selection: DateRangeSelection) => DateRangeRequest
576
- DateRangeVariable.describeInput: (input: DateRangeRequest) => string
577
- DateRangeVariable.bounds: () => { minDate?: string | undefined; maxDate: string; maxRangeDays: number; timeZone: string; }
578
- DateRangeVariable.resolve: (selection: DateRangeSelection) => DateRange
579
- DateRangeVariable.previous: (selection: DateRangeSelection) => DateRange | null
580
- DateRangeVariable.comparisonRange: (selection: DateRangeSelection) => DateRange | null
581
- DateRangeVariableOptions (type, @altertable/data-app-react): = props listed as dateRangeVariable.options.*
582
524
  DateTimeFormatOptions (type, @altertable/data-app/format)
583
525
  DateTimeFormatOptions.locale?: string
584
526
  DateTimeFormatOptions.missing?: string
@@ -635,6 +577,9 @@ DateTimeRangePicker.maxRangeDays?: number — Client limit for determinate durat
635
577
  DateTimeRangePicker.contract?: { datetime: { timeZone: string; bounds: (now?: Date | undefined) => { minDate: string | undefined; maxDate: string; maxRangeDays: number; timeZone: string; }; parse: (value: unknown, now?: Date | undefined) => DateTimeRange; resolve: (value: unknown, now?: Date | undefined) => ResolvedDateTimeRange… — Shared reporting policy; generated controls inherit it from their variable.
636
578
  DateTimeRangePicker.presets?: readonly DateTimeRangePreset[] — Suggestions in display order. Omit for defaults; [] retains calendar and text entry. Invalid or over-limit suggestions are omitted; typed input is not restricted to the menu.
637
579
  DateTimeRangePicker.disabled?: boolean
580
+ DateTimeRangePicker.isDefault?: boolean
581
+ DateTimeRangePicker.onReset?: (() => void)
582
+ DateTimeRangePicker.calendarFooter?: ReactNode
638
583
  DateTimeRangePicker.comparison?: { enabled: boolean; range: DateTimeRange | null; onChange: (enabled: boolean) => void; } — Optional controlled comparison with the immediately preceding equal-length interval.
639
584
  DateTimeRangePickerProps (type, @altertable/data-app-react, @altertable/data-app-react/ui): = props listed as DateTimeRangePicker.*
640
585
  DateTimeRangePreset (type, @altertable/data-app/contract, @altertable/data-app-react, @altertable/data-app-react/ui): A picker suggestion. Text ranges use the same natural-language parser as typed input.
@@ -702,7 +647,7 @@ defineDataApp.config.queries: Queries & KnownRecord<Queries> & ('' extends keyof
702
647
  defineDataIdentifiers (function, @altertable/data-app-react): <const Tables extends Record<string, TableIdentifier>, const Columns extends Record<string, ColumnIdentifier<Extract<keyof Tables, string>>>>(options: {…}): { definitions: Readonly<Record<IdentifierId<Tables, Columns>, DataIdentifierDefinition>>; DataIdentifier: ({ id, display }: { ...; }) => Eleme… — Register exact source names once; returned JSX IDs are checked against this registry.
703
648
  defineDataIdentifiers.options.tables: Tables
704
649
  defineDataIdentifiers.options.columns: Columns
705
- defineDateRangeContract (function, @altertable/data-app/contract): (options: DateRangeContractOptions): { datetime: { timeZone: string; bounds: (now?: Date | undefined) => { minDate: string | undefined; maxDate: string; maxRangeDays: number; timeZone: string; }; parse: (value: unknown, now?: Date | undefined) => DateTimeRange; resolve: (value: unknown, now?: Date… — One source policy for the server parser, URL variable, and displayed reporting period.
650
+ defineDateRangeContract (function, @altertable/data-app/contract): (options: DateRangeContractOptions): { datetime: { timeZone: string; bounds: (now?: Date | undefined) => { minDate: string | undefined; maxDate: string; maxRangeDays: number; timeZone: string; }; parse: (value: unknown, now?: Date | undefined) => DateTimeRange; resolve: (value: unknown, now?: Date… — One source policy for datetime picker validation and operation requests.
706
651
  defineDateRangeContract.options.minDate?: string
707
652
  defineDateRangeContract.options.maxDate?: string | (() => string)
708
653
  defineDateRangeContract.options.maxRangeDays: number
@@ -877,6 +822,7 @@ FunnelChart.ariaLabel: string — Accessible measure and scope description.
877
822
  FunnelChart.unit: string — Population unit, such as users or sessions.
878
823
  FunnelChart.formatValue?: ((value: number) => string) — Formats counts; rates use percentage formatting.
879
824
  FunnelChart.className?: string
825
+ FunnelChart.horizontalGrid?: boolean — Draw horizontal grid lines behind the plotted values.
880
826
  FunnelChart.steps: readonly FunnelChartStep[]
881
827
  FunnelChart.series: readonly FunnelChartSeries[]
882
828
  FunnelChartProps (type, @altertable/data-app-react/ui): = props listed as FunnelChart.*
@@ -976,10 +922,13 @@ LineChart.itemActions?: ItemActions<Row> — Actions available for each displaye
976
922
  LineChart.unit: string
977
923
  LineChart.ariaLabel: string
978
924
  LineChart.formatValue?: ((value: number) => string)
925
+ LineChart.horizontalGrid?: boolean — Draw horizontal grid lines behind the plotted values.
926
+ LineChart.cursorGroup?: ChartCursorGroup — Share mouse-hover timestamps with charts receiving the same handle. Matches each item's time exactly.
979
927
  LineChartItem (type, @altertable/data-app-react/ui)
980
928
  LineChartItem.id: string
981
929
  LineChartItem.label: string
982
930
  LineChartItem.value: number
931
+ LineChartItem.time?: number — Optional timestamp in epoch milliseconds for cursor linking. Omit for category samples.
983
932
  LineChartProps (type, @altertable/data-app-react/ui): <Row> = props listed as LineChart.*
984
933
  LiveControl (component, @altertable/data-app-react/ui): (props: LiveControlProps) — Toggle an app-owned recurring refresh. The app supplies the timer and its cadence.
985
934
  LiveControl.enabled: boolean
@@ -1022,7 +971,7 @@ MetricFormat (type, @altertable/data-app/format): = props listed as formatMetric
1022
971
  MetricReading (type, @altertable/data-app-react/ui)
1023
972
  MetricReading.loading: true [variant 1 of 2]
1024
973
  MetricReading.loading: false [variant 2 of 2]
1025
- MetricReading.value: MetricValues & { period?: DateRangeRequest | DateTimeRangeRequest | undefined; } [variant 2 of 2]
974
+ MetricReading.value: MetricValues & { period?: DateTimeRangeRequest | undefined; } [variant 2 of 2]
1026
975
  MetricRecords (class, @altertable/data-app-react): <Data, Input, DetailData, DetailInput> — A metric-owned record destination. It can only render from that metric's displayed source.
1027
976
  MetricRecords.render: (source: ViewSource<Data, Input>, navigation?: DetailNavigation | undefined) => { scope: string; content: FunctionComponentElement<{ content: DetailContent<any, any>; input: any; navigation?: DetailNavigation | undefined; }>; } | undefined
1028
977
  MetricValues (type, @altertable/data-app-react): Zero is measured data. null or omitted means no previous measurement. Comparison activation belongs to the reading's period, not these values.
@@ -1153,10 +1102,6 @@ parseBooleanSelection.filter.write: (value: BooleanSelection) => Record<string,
1153
1102
  parseBooleanSelection.filter.valid: (value: BooleanSelection) => boolean
1154
1103
  parseBooleanSelection.filter.same: (left: BooleanSelection, right: BooleanSelection) => boolean
1155
1104
  parseCount (function, @altertable/data-app/contract): (value: unknown): number — Accepts numeric strings from DuckDB; rejects negative, fractional, and unsafe integers.
1156
- parseDateRangeInput (function, @altertable/data-app/contract): (value: unknown, options: {…}): DateRange — Validate calendar dates and a bounded inclusive range on the server.
1157
- parseDateRangeInput.options.minDate?: string
1158
- parseDateRangeInput.options.maxDate?: string
1159
- parseDateRangeInput.options.maxRangeDays: number
1160
1105
  parseDateTime (function, @altertable/data-app/format): (value: DateTimeValue): Date | null — Parse only unambiguous instants. String values must include `Z` or an explicit offset.
1161
1106
  parseDateTimeBound (function, @altertable/data-app/contract): (text: string): AbsoluteOrRelativeDateTime | null — Parse one bound without resolving relative anchors or offsets.
1162
1107
  parseDateTimeRange (function, @altertable/data-app/contract): (value: unknown, options: {…}): DateTimeRange — Validate and restore UTC-rebased dates from JSON, without resolving relative bounds.
@@ -1261,9 +1206,6 @@ PresentStory.headerActions?: ReactNode
1261
1206
  PresentStory.footer?: ReactNode
1262
1207
  PresentStory.…: plus props inherited from React
1263
1208
  PresentStoryProps (type, @altertable/data-app-react/ui): = props listed as PresentStory.*
1264
- previousDateRange (function, @altertable/data-app/contract): (options: DateRange): DateRange — The immediately preceding, equally long set of calendar days.
1265
- previousDateRange.options.start: string
1266
- previousDateRange.options.end: string
1267
1209
  QueryDefinitions (type, @altertable/data-app, @altertable/data-app/config, @altertable/data-app/contract): <Record<string, QueryDefinition>> = { readonly [x: string]: QueryDefinition; }
1268
1210
  QueryField (type, @altertable/data-app, @altertable/data-app/config, @altertable/data-app/contract)
1269
1211
  QueryField.type: keyof QueryValues
@@ -1342,6 +1284,7 @@ RetentionChart.ariaLabel: string — Accessible measure and scope description.
1342
1284
  RetentionChart.unit: string — Population unit, such as users or sessions.
1343
1285
  RetentionChart.formatValue?: ((value: number) => string) — Formats counts; rates use percentage formatting.
1344
1286
  RetentionChart.className?: string
1287
+ RetentionChart.horizontalGrid?: boolean — Draw horizontal grid lines behind the plotted values.
1345
1288
  RetentionChart.series: readonly RetentionChartSeries[]
1346
1289
  RetentionChartPoint (type, @altertable/data-app-react/ui)
1347
1290
  RetentionChartPoint.offset: number — Nonnegative integer, unique per series; uneven offsets retain their distance.
@@ -1356,6 +1299,7 @@ RetentionChartSeries.label: string
1356
1299
  RetentionChartSeries.cohortSize: number — Finite, nonnegative starting population.
1357
1300
  RetentionChartSeries.points: readonly RetentionChartPoint[]
1358
1301
  ScatterChart (component, @altertable/data-app-react/ui): (props: ScatterChartProps) — Independent finite X/Y observations on linear axes that include zero. Negative and constant coordinates are supported.
1302
+ ScatterChart.horizontalGrid?: boolean — Draw horizontal grid lines behind the plotted values.
1359
1303
  ScatterChart.items: readonly ScatterChartItem[]
1360
1304
  ScatterChart.xLabel: string
1361
1305
  ScatterChart.yLabel: string
@@ -1636,6 +1580,7 @@ Tooltip.variant?: 'chart' | 'hint'
1636
1580
  Tooltip.onOpenChange?: ((open: boolean) => void)
1637
1581
  Tooltip.align?: 'center' | 'end' | 'start'
1638
1582
  Tooltip.placement?: 'bottom' | 'top'
1583
+ Tooltip.followCursor?: boolean — Set false to keep a chart tooltip at its entry position while hovering one sample.
1639
1584
  Tooltip.portalRoot?: RefObject<HTMLElement | null>
1640
1585
  Tooltip.…: plus props inherited from React
1641
1586
  TooltipProps (type, @altertable/data-app-react, @altertable/data-app-react/ui): = props listed as Tooltip.*
@@ -1658,6 +1603,7 @@ UpdatedAt.onOpenChange?: ((open: boolean) => void)
1658
1603
  UpdatedAt.timeZone?: string
1659
1604
  UpdatedAtProps (type, @altertable/data-app-react): = props listed as UpdatedAt.*
1660
1605
  useAppVariables (hook, @altertable/data-app-react/ui): <const Variables extends VariableCollection>(definitions: Variables): { values: AppVariableValues<Variables>; calendarRevision: number; set: <Key extends keyof Variables & string>(name: Key, value: AppVariableValues<Variables>[Key]) => void; ... 4 more ...; bind: <Key extends keyof Variables & stri… — URL is the source of truth for app variables; one update can change dependent values atomically.
1606
+ useChartCursorGroup (hook, @altertable/data-app-react/ui): (): ChartCursorGroup — Creates a stable shared mouse-hover cursor handle. Pass it explicitly to each participating chart's cursorGroup prop. Peers indicate exact timestamp matches while tooltips remain local.
1661
1607
  useDateFormatting (hook, @altertable/data-app-react, @altertable/data-app-react/ui): (options: {…}): { locale: string; timeZone: string; } — Resolve date display defaults for custom charts and narrative. Explicit options override the view and app.
1662
1608
  useDateFormatting.options.locale?: string
1663
1609
  useDateFormatting.options.timeZone?: string
@@ -1668,7 +1614,7 @@ VariableBar (component, @altertable/data-app-react/ui): (props: VariableBarProps
1668
1614
  VariableBar.children: ReactNode
1669
1615
  VariableBar.…: plus props inherited from React
1670
1616
  VariableBarProps (type, @altertable/data-app-react/ui): = props listed as VariableBar.*
1671
- variableInput (function, @altertable/data-app/contract): <Input extends object, const Variables extends VariableCollection>(parse: (value: unknown) => Input, variables: Variables & { [Key in keyof Variables]: Variables[Key] extends { kind: 'dateRange'; } ? never : Variables[Key]; }): (value: unknown) => Input & ParsedVariableValues<Variables> — Validate named variable values at the operation boundary. Date inputs belong to the base parser.
1617
+ variableInput (function, @altertable/data-app/contract): <Input extends object, const Variables extends VariableCollection>(parse: (value: unknown) => Input, variables: Variables): (value: unknown) => Input & ParsedVariableValues<Variables> — Validate named variable values at the operation boundary.
1672
1618
  VariablePresentation (type, @altertable/data-app-react)
1673
1619
  VariablePresentation.group?: 'display' | 'scope' — Scope changes the included data; display changes its presentation. Defaults to scope.
1674
1620
  VariablePresentation.control?: 'toolbar' | 'widget' — Widget controls render beside their visualization instead of in the toolbar. Scope filters remain available in the Filters sheet and active summaries.
@@ -1,4 +1,4 @@
1
- import { _ as fixedUnitMilliseconds, g as serializeDateTimeRange, h as resolveDateTimeRange, m as parseDateTimeRange, n as formatDateRange, v as invariant } from "./format-5hMYUWk3.js";
1
+ import { a as resolveDateTimeRange, c as invariant, i as parseDateTimeRange, o as serializeDateTimeRange, s as fixedUnitMilliseconds } from "./date-time-range-value-TE8KCsfV.js";
2
2
  import { fromDate, parseDate, toCalendarDateTime, today } from "@internationalized/date";
3
3
  //#region src/core/date-time-range-contract.ts
4
4
  function createDateTimeRangeContract(options) {
@@ -401,7 +401,7 @@ var DimensionMembershipError = class extends Error {
401
401
  return value instanceof Error && value[invalidMemberKey] === true;
402
402
  }
403
403
  };
404
- /** Validate named variable values at the operation boundary. Date inputs belong to the base parser. */
404
+ /** Validate named variable values at the operation boundary. */
405
405
  function variableInput(parse, variables) {
406
406
  const previous = parserVariables.get(parse) ?? {};
407
407
  const definitions = { ...variables };
@@ -539,18 +539,7 @@ function parseTrue(value) {
539
539
  invariant(value === true, "Expected a successful check.");
540
540
  return true;
541
541
  }
542
- /** The immediately preceding, equally long set of calendar days. */
543
- function previousDateRange({ start, end }) {
544
- const first = parseDate(start);
545
- const days = (parseDate(end).toDate("UTC").getTime() - first.toDate("UTC").getTime()) / fixedUnitMilliseconds.DAY + 1;
546
- invariant(days >= 1, "Date range must start before it ends.");
547
- const previousEnd = first.subtract({ days: 1 });
548
- return {
549
- start: previousEnd.subtract({ days: days - 1 }).toString(),
550
- end: previousEnd.toString()
551
- };
552
- }
553
- /** One source policy for the server parser, URL variable, and displayed reporting period. */
542
+ /** One source policy for datetime picker validation and operation requests. */
554
543
  function defineDateRangeContract({ minDate, maxDate, maxRangeDays, timeZone, completeDays }) {
555
544
  invariant(Number.isInteger(maxRangeDays) && maxRangeDays > 0, "Date range needs a positive maxRangeDays.");
556
545
  if (minDate) parseDate(minDate);
@@ -563,75 +552,9 @@ function defineDateRangeContract({ minDate, maxDate, maxRangeDays, timeZone, com
563
552
  timeZone,
564
553
  completeDays
565
554
  });
566
- const bounds = datetime.bounds;
567
- function period({ start, end }) {
568
- return {
569
- kind: "calendar",
570
- start,
571
- end,
572
- timeZone
573
- };
574
- }
575
- function describeInput(input) {
576
- return `${formatDateRange(input)} ${timeZone}`;
577
- }
578
- function comparison(input) {
579
- const previous = previousDateRange(input);
580
- return minDate && previous.start < minDate ? null : previous;
581
- }
582
- function request(value, compare = false) {
583
- const range = parseDateRangeInput(value, bounds());
584
- const previous = compare ? comparison(range) : null;
585
- invariant(!compare || previous, "Comparison is outside available source coverage.");
586
- return {
587
- range,
588
- comparison: previous
589
- };
590
- }
591
- function parseRequest(value) {
592
- invariant(value && typeof value === "object", "Choose a date range.");
593
- const input = value;
594
- const parsed = request(input.range, input.comparison != null);
595
- if (input.comparison != null) {
596
- const supplied = parseDateRangeInput(input.comparison, bounds());
597
- invariant(supplied.start === parsed.comparison?.start && supplied.end === parsed.comparison?.end, "Comparison must be the preceding equal-length range.");
598
- }
599
- return parsed;
600
- }
601
555
  return {
602
556
  datetime,
603
- request,
604
- parseRequest,
605
- bounds,
606
- parse(value) {
607
- return parseDateRangeInput(value, bounds());
608
- },
609
- period,
610
- comparison,
611
- describeInput,
612
- view: {
613
- period,
614
- describeInput
615
- }
616
- };
617
- }
618
- /** Validate calendar dates and a bounded inclusive range on the server. */
619
- function parseDateRangeInput(value, { minDate, maxDate, maxRangeDays }) {
620
- invariant(value && typeof value === "object" && !Array.isArray(value), "Choose a date range.");
621
- const { start, end } = value;
622
- function day(input) {
623
- invariant(typeof input === "string" && /^\d{4}-\d{2}-\d{2}$/.test(input), "Dates must be YYYY-MM-DD.");
624
- const timestamp = Date.parse(`${input}T00:00:00Z`);
625
- invariant(Number.isFinite(timestamp) && new Date(timestamp).toISOString().slice(0, 10) === input, "Choose valid calendar dates.");
626
- return timestamp;
627
- }
628
- const first = day(start);
629
- const last = day(end);
630
- invariant(Number.isInteger(maxRangeDays) && maxRangeDays > 0, "Maximum range days must be positive.");
631
- invariant(first <= last && (last - first) / fixedUnitMilliseconds.DAY < maxRangeDays && (minDate === void 0 || first >= day(minDate)) && (maxDate === void 0 || last <= day(maxDate)), `Choose up to ${maxRangeDays} days within the available range.`);
632
- return {
633
- start,
634
- end
557
+ bounds: datetime.bounds
635
558
  };
636
559
  }
637
560
  /** Accepts numeric strings from DuckDB; rejects negative, fractional, and unsafe integers. */
@@ -698,6 +621,6 @@ function connectionCheck(queries) {
698
621
  });
699
622
  }
700
623
  //#endregion
701
- export { dimensionPredicate as C, KEY_SEPARATOR as E, dimensionMemberKey as S, parseFacetOptions as T, isQueryParameters as _, parseCount as a, createDimensionFilter as b, parseLabel as c, DimensionMembershipError as d, bindDimensionSource as f, MAX_QUERY_ROWS as g, withDimensionSelectors as h, defineQueryNames as i, parseTrue as l, variableInput as m, defineDateRangeContract as n, parseDateRangeInput as o, dimensionSource as p, defineOperation as r, parseEmptyInput as s, connectionCheck as t, previousDateRange as u, snapshotQueries as v, parseDimensionSelection as w, dimensionFilter as x, dateTimeRangeSql as y };
624
+ export { parseFacetOptions as C, parseDimensionSelection as S, dateTimeRangeSql as _, parseCount as a, dimensionMemberKey as b, parseTrue as c, dimensionSource as d, variableInput as f, snapshotQueries as g, isQueryParameters as h, defineQueryNames as i, DimensionMembershipError as l, MAX_QUERY_ROWS as m, defineDateRangeContract as n, parseEmptyInput as o, withDimensionSelectors as p, defineOperation as r, parseLabel as s, connectionCheck as t, bindDimensionSource as u, createDimensionFilter as v, KEY_SEPARATOR as w, dimensionPredicate as x, dimensionFilter as y };
702
625
 
703
- //# sourceMappingURL=contract-B3s0ybE2.js.map
626
+ //# sourceMappingURL=contract-DsyRYgN_.js.map