@altertable/data-app 0.74.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 (54) hide show
  1. package/AGENTS.md +11 -3
  2. package/CONTRIBUTING.md +14 -3
  3. package/README.md +56 -9
  4. package/REFERENCE.md +194 -99
  5. package/dist/chunks/{contract-BeLPJwlO.js → contract-DsyRYgN_.js} +176 -108
  6. package/dist/chunks/contract-DsyRYgN_.js.map +1 -0
  7. package/dist/chunks/{contract-Di8SP74I.js → contract-kNFYPHRK.js} +255 -4
  8. package/dist/chunks/contract-kNFYPHRK.js.map +1 -0
  9. package/dist/chunks/date-time-range-value-TE8KCsfV.js +648 -0
  10. package/dist/chunks/date-time-range-value-TE8KCsfV.js.map +1 -0
  11. package/dist/chunks/{diagnostics-BTZSlNtW.js → diagnostics-DhCqGklq.js} +2 -2
  12. package/dist/chunks/{diagnostics-BTZSlNtW.js.map → diagnostics-DhCqGklq.js.map} +1 -1
  13. package/dist/chunks/{operation-CSM9UmO3.js → operation-7tiT4cpJ.js} +3 -3
  14. package/dist/chunks/{operation-CSM9UmO3.js.map → operation-7tiT4cpJ.js.map} +1 -1
  15. package/dist/client/index.js +51 -5
  16. package/dist/client/index.js.map +1 -1
  17. package/dist/core/config.js +4 -3
  18. package/dist/core/config.js.map +1 -1
  19. package/dist/core/contract.js +4 -3
  20. package/dist/core/format.js +149 -1
  21. package/dist/core/format.js.map +1 -0
  22. package/dist/internal.js +6 -189
  23. package/dist/internal.js.map +1 -1
  24. package/dist/server/index.js +3 -3
  25. package/dist/server/index.js.map +1 -1
  26. package/dist/types/chunks/contract.d.ts +133 -264
  27. package/dist/types/chunks/contract2.d.ts +207 -0
  28. package/dist/types/chunks/date-time-range-value.d.ts +20 -0
  29. package/dist/types/chunks/date-time-range.d.ts +29 -0
  30. package/dist/types/chunks/index.d.ts +14 -2
  31. package/dist/types/client/index.d.ts +3 -3
  32. package/dist/types/core/config.d.ts +6 -4
  33. package/dist/types/core/contract.d.ts +5 -2
  34. package/dist/types/core/format.d.ts +21 -1
  35. package/dist/types/index.d.ts +3 -2
  36. package/dist/types/internal.d.ts +11 -4
  37. package/dist/types/server/index.d.ts +2 -2
  38. package/docs/app-authoring.md +46 -14
  39. package/docs/composition.md +4 -23
  40. package/docs/contract.md +42 -9
  41. package/docs/diagnostics.md +37 -0
  42. package/docs/embed.md +38 -0
  43. package/docs/hosted-apps.md +7 -4
  44. package/docs/local-data-apps.md +17 -2
  45. package/docs/react.md +6 -3
  46. package/docs/stories-and-export.md +14 -5
  47. package/docs/ui-quality.md +3 -2
  48. package/docs/ui.md +53 -2
  49. package/docs/variables.md +80 -8
  50. package/package.json +17 -5
  51. package/dist/chunks/contract-BeLPJwlO.js.map +0 -1
  52. package/dist/chunks/contract-Di8SP74I.js.map +0 -1
  53. package/dist/chunks/format-BdFlv_xa.js +0 -148
  54. package/dist/chunks/format-BdFlv_xa.js.map +0 -1
@@ -0,0 +1,207 @@
1
+ import { n as DateTimeRange } from "./date-time-range.js";
2
+ import { Bt as OperationContracts, Dt as QueryParameters, Ft as DataQueryInput, Ht as QueryResult, J as NavigationUpdate, Pt as DataQueryBody, Ut as TransportResponse, Vt as OutputOf } from "./contract.js";
3
+ //#region src/core/date-time-range-sql.d.ts
4
+ /** DuckDB timestamp expressions using the query session's timezone for relative anchors.
5
+ * Absolute fields remain UTC-rebased TIMESTAMP values. Start is inclusive, end exclusive.
6
+ */
7
+ declare function dateTimeRangeSql(range: DateTimeRange, parameter?: string): {
8
+ from: string;
9
+ to: string;
10
+ params: Record<string, string>;
11
+ };
12
+ //#endregion
13
+ //#region src/core/messages.d.ts
14
+ type MessageContext = {
15
+ signal: AbortSignal;
16
+ };
17
+ type RoutedMessage = {
18
+ route: string;
19
+ payload: unknown;
20
+ };
21
+ type MessageDispatcher = (message: unknown, context: MessageContext) => Promise<unknown>;
22
+ type MessageTransport = (message: RoutedMessage, signal?: AbortSignal) => Promise<unknown>;
23
+ type MessageRoute<Input, Output> = {
24
+ input: (value: unknown) => Input;
25
+ output: (value: unknown, input: Input) => Output;
26
+ };
27
+ type MessageRoutes = Record<string, {
28
+ input: (value: unknown) => unknown;
29
+ output: (value: unknown, input: never) => unknown;
30
+ }>;
31
+ type MessageInput<Route extends MessageRoutes[string]> = ReturnType<Route['input']>;
32
+ type MessageHandlers<Routes extends MessageRoutes> = { [Name in keyof Routes]: (payload: MessageInput<Routes[Name]>, context: MessageContext) => ReturnType<Routes[Name]['output']> | Promise<ReturnType<Routes[Name]['output']>>; };
33
+ declare const errorBrand: unique symbol;
34
+ /** Only these deliberate, public failures cross the message boundary. Other errors stay private. */
35
+ declare class MessageRoutingError extends Error {
36
+ readonly code: string;
37
+ readonly requestId?: string | undefined;
38
+ readonly [errorBrand] = true;
39
+ static [Symbol.hasInstance](value: unknown): boolean;
40
+ constructor(code: string, message: string, requestId?: string | undefined,
41
+ /** `cause` stays with the host for logs; the bridge sends only code, message, and request ID. */
42
+ options?: ErrorOptions);
43
+ }
44
+ declare function defineMessageRoute<Input, Output>(route: MessageRoute<Input, Output>): MessageRoute<Input, Output>;
45
+ /** Contracts are shared; handlers are supplied by the host and never belong in the app bundle. */
46
+ declare function createMessageRouter<const Routes extends MessageRoutes>(routes: Routes, handlers: MessageHandlers<NoInfer<Routes>>): {
47
+ dispatch: (value: unknown, context: MessageContext) => Promise<unknown>;
48
+ };
49
+ type DataQueryRoute<Operations extends OperationContracts> = MessageRoute<DataQueryInput<Operations>, TransportResponse> & {
50
+ operations: Operations | undefined;
51
+ };
52
+ type MessageOutput<Route extends MessageRoutes[string], Input> = Route extends DataQueryRoute<infer Operations> ? Input extends {
53
+ operation: infer Name extends keyof Operations;
54
+ } ? TransportResponse<DataQueryBody<OutputOf<Operations[Name]>>> : never : ReturnType<Route['output']>;
55
+ /** Omit contracts only in generic hosts such as the CLI shell, where Bun validates operations. */
56
+ declare function defineDataQueryRoute<Operations extends OperationContracts = OperationContracts>(operations?: Operations): DataQueryRoute<Operations>;
57
+ declare const navigationUpdateRoute: MessageRoute<NavigationUpdate, null>;
58
+ type SqlQueryInput = {
59
+ statement: string;
60
+ limit: number;
61
+ params?: QueryParameters;
62
+ };
63
+ /** SQL delivery for browser-owned operations. Hosts must enforce backend access and resource limits. */
64
+ declare const sqlQueryRoute: MessageRoute<SqlQueryInput, QueryResult>;
65
+ declare const dataAppRoutes: {
66
+ 'data:query': DataQueryRoute<OperationContracts>;
67
+ 'navigation:update': MessageRoute<NavigationUpdate, null>;
68
+ };
69
+ //#endregion
70
+ //#region src/core/annotations.d.ts
71
+ type DataAppAnnotationDraft = {
72
+ id: string;
73
+ target: {
74
+ id: string;
75
+ label: string;
76
+ kind: 'widget' | 'element' | 'app';
77
+ text: string;
78
+ queryNames: string[];
79
+ glossaryIds: string[];
80
+ };
81
+ context: {
82
+ search: string;
83
+ hash: string;
84
+ displayedInput?: unknown;
85
+ /** Normalized position within the selected target, stable across scrolling/resizing. */
86
+ anchor?: {
87
+ x: number;
88
+ y: number;
89
+ };
90
+ cursor?: {
91
+ x: number;
92
+ y: number;
93
+ };
94
+ /** Normalized custom selection rectangle within the iframe document. */
95
+ region?: {
96
+ x: number;
97
+ y: number;
98
+ width: number;
99
+ height: number;
100
+ };
101
+ screenshot?: {
102
+ mimeType: 'image/png';
103
+ dataUrl: string;
104
+ width: number;
105
+ height: number;
106
+ };
107
+ view?: string;
108
+ viewport: {
109
+ width: number;
110
+ height: number;
111
+ };
112
+ rect: {
113
+ x: number;
114
+ y: number;
115
+ width: number;
116
+ height: number;
117
+ };
118
+ };
119
+ comment: string;
120
+ };
121
+ type DataAppAnnotationPresentation = {
122
+ enabled: boolean;
123
+ /** When provided, the host owns the mode and renders the annotation trigger. */
124
+ active?: boolean;
125
+ pinsVisible?: boolean;
126
+ showHint?: boolean;
127
+ readOnly?: boolean;
128
+ targets?: {
129
+ id: string;
130
+ targetId: string;
131
+ number: number;
132
+ comment?: string;
133
+ anchor?: {
134
+ x: number;
135
+ y: number;
136
+ };
137
+ region?: {
138
+ x: number;
139
+ y: number;
140
+ width: number;
141
+ height: number;
142
+ };
143
+ }[];
144
+ selectedAnnotationId?: string;
145
+ selectedTargetId?: string;
146
+ selectionId?: string;
147
+ /** Confirmed host click outside the iframe; occurredAt is epoch milliseconds. */
148
+ dismissal?: {
149
+ id: string;
150
+ occurredAt: number;
151
+ };
152
+ };
153
+ /** Reconstruct at the boundary; discard extra fields and bound the entire JSON payload. */
154
+ declare function parseDataAppAnnotationDraft(value: unknown): DataAppAnnotationDraft;
155
+ declare const annotationDraftRoute: MessageRoute<DataAppAnnotationDraft, null>;
156
+ declare const annotationEditorStateRoute: MessageRoute<{
157
+ hasUnsavedChanges: boolean;
158
+ }, null>;
159
+ /** Request host-owned batch submission without transferring ownership of drafts. */
160
+ declare const annotationSendRoute: MessageRoute<null, null>;
161
+ declare const annotationUpdateRoute: MessageRoute<{
162
+ id: string;
163
+ comment: string;
164
+ }, null>;
165
+ /** A controlled shell acknowledges local exits (for example Escape). */
166
+ declare const annotationModeRoute: MessageRoute<{
167
+ active: boolean;
168
+ }, null>;
169
+ //#endregion
170
+ //#region src/core/external-link.d.ts
171
+ /** Absolute HTTPS destinations only; URLs must not contain embedded credentials. */
172
+ declare function parseExternalUrl(value: unknown): string;
173
+ type ExternalLinkTarget = 'tab' | 'window';
174
+ type ExternalLinkModifiers = {
175
+ shiftKey: boolean;
176
+ metaKey: boolean;
177
+ ctrlKey: boolean;
178
+ };
179
+ type OpenExternalLink = {
180
+ url: string;
181
+ } & ({
182
+ target?: ExternalLinkTarget;
183
+ } | {
184
+ target: 'event';
185
+ keys: ExternalLinkModifiers;
186
+ });
187
+ type ExternalLinkResult = 'opened' | 'cancelled' | 'ignored';
188
+ /** Shift takes precedence over Ctrl/Cmd; an unmodified event requests no navigation. */
189
+ declare function resolveExternalLinkTarget(input: OpenExternalLink): ExternalLinkTarget | null;
190
+ /** Opt-in host route. Validation does not replace the host's destination policy. */
191
+ declare const openExternalLinkRoute: MessageRoute<OpenExternalLink, ExternalLinkResult>;
192
+ //#endregion
193
+ //#region src/core/contract.d.ts
194
+ declare const sourceErrorBrand: unique symbol;
195
+ declare class DataSourceError extends Error {
196
+ readonly reason: 'unauthorized' | 'forbidden' | 'rate_limited' | 'query_rejected' | 'unavailable';
197
+ readonly status?: number | undefined;
198
+ readonly [sourceErrorBrand] = true;
199
+ queryName?: string;
200
+ static [Symbol.hasInstance](value: unknown): boolean;
201
+ constructor(reason: 'unauthorized' | 'forbidden' | 'rate_limited' | 'query_rejected' | 'unavailable', status?: number | undefined,
202
+ /** `cause` stays on the server or host for logs; responses carry only the reason. */
203
+ options?: ErrorOptions);
204
+ }
205
+ //#endregion
206
+ export { dataAppRoutes as A, MessageRoute as C, RoutedMessage as D, MessageTransport as E, dateTimeRangeSql as F, defineMessageRoute as M, navigationUpdateRoute as N, SqlQueryInput as O, sqlQueryRoute as P, MessageOutput as S, MessageRoutingError as T, DataQueryRoute as _, OpenExternalLink as a, MessageHandlers as b, resolveExternalLinkTarget as c, annotationDraftRoute as d, annotationEditorStateRoute as f, parseDataAppAnnotationDraft as g, annotationUpdateRoute as h, ExternalLinkTarget as i, defineDataQueryRoute as j, createMessageRouter as k, DataAppAnnotationDraft as l, annotationSendRoute as m, ExternalLinkModifiers as n, openExternalLinkRoute as o, annotationModeRoute as p, ExternalLinkResult as r, parseExternalUrl as s, DataSourceError as t, DataAppAnnotationPresentation as u, MessageContext as v, MessageRoutes as w, MessageInput as x, MessageDispatcher as y };
207
+ //# sourceMappingURL=contract2.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { n as DateTimeRange, t as AbsoluteOrRelativeDateTime } from "./date-time-range.js";
2
+ //#region src/core/date-time-range-value.d.ts
3
+ /** Validate and restore UTC-rebased dates from JSON, without resolving relative bounds. */
4
+ declare function parseDateTimeRange(value: unknown, { maxRangeDays }?: {
5
+ maxRangeDays?: number;
6
+ }): DateTimeRange;
7
+ /** Canonical URL/JSON representation. Dates retain their encoded UTC fields. */
8
+ declare function serializeDateTimeRange(value: DateTimeRange): string;
9
+ /** UTC preview only. Backend execution owns reporting-timezone interpretation. Null start is unbounded; null end is now. */
10
+ declare function resolveDateTimeRange(value: DateTimeRange, now?: Date): {
11
+ from: Date | null;
12
+ to: Date;
13
+ };
14
+ declare function formatDateTimeBound(value: AbsoluteOrRelativeDateTime | null | undefined, fallback?: string): string;
15
+ declare function formatDateTimeRange(value: DateTimeRange): string;
16
+ /** Parse one bound without resolving relative anchors or offsets. */
17
+ declare function parseDateTimeBound(text: string): AbsoluteOrRelativeDateTime | null;
18
+ //#endregion
19
+ export { resolveDateTimeRange as a, parseDateTimeRange as i, formatDateTimeRange as n, serializeDateTimeRange as o, parseDateTimeBound as r, formatDateTimeBound as t };
20
+ //# sourceMappingURL=date-time-range-value.d.ts.map
@@ -0,0 +1,29 @@
1
+ //#region src/core/date-time-range.d.ts
2
+ /** Frontend-compatible range values. Absolute dates encode wall-clock fields as UTC,
3
+ * not instants converted from a reporting timezone. The backend interprets that zone.
4
+ */
5
+ type AbsoluteOrRelativeDateTime = Date | RelativeDateTime;
6
+ type DateTimeRange = {
7
+ /** Inclusive start; null or omitted means unbounded. */
8
+ from?: AbsoluteOrRelativeDateTime | null;
9
+ /** Exclusive end; null or omitted means now. */
10
+ to?: AbsoluteOrRelativeDateTime | null;
11
+ };
12
+ type RelativeDateTime = {
13
+ anchor: RelativeAnchor;
14
+ offset: RelativeOffset[];
15
+ };
16
+ type RelativeOffset = {
17
+ amount: number;
18
+ unit: RelativeUnit;
19
+ };
20
+ type RelativeAnchor = 'RELATIVE_ANCHOR_NOW' | 'RELATIVE_ANCHOR_START_OF_TODAY' | 'RELATIVE_ANCHOR_START_OF_YESTERDAY' | 'RELATIVE_ANCHOR_START_OF_TOMORROW' | 'RELATIVE_ANCHOR_START_OF_WEEK' | 'RELATIVE_ANCHOR_START_OF_MONTH' | 'RELATIVE_ANCHOR_START_OF_YEAR';
21
+ type RelativeUnit = 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
22
+ /** Bounded, resolved wall-clock dates encoded in UTC, with an exclusive end. */
23
+ type ResolvedDateTimeRange = {
24
+ from: Date;
25
+ to: Date;
26
+ };
27
+ //#endregion
28
+ export { RelativeOffset as a, RelativeDateTime as i, DateTimeRange as n, RelativeUnit as o, RelativeAnchor as r, ResolvedDateTimeRange as s, AbsoluteOrRelativeDateTime as t };
29
+ //# sourceMappingURL=date-time-range.d.ts.map
@@ -1,4 +1,5 @@
1
- import { Dt as HistoryMode, Et as AppLocation, Qt as KnownRecord, Zt as IsUnion, _ as MessageRoutes, _n as OutputOf, b as RoutedMessage, h as MessageOutput, ln as DataOperations, m as MessageInput, mn as Lakehouse, n as DataAppAnnotationDraft, pn as InputOf, rn as QueryParameters, un as DataQueryBody, vn as QueryResult, y as MessageTransport, yn as TransportResponse } from "./contract.js";
1
+ import { Dt as QueryParameters, Ht as QueryResult, K as AppLocation, Lt as InputOf, Nt as DataOperations, Pt as DataQueryBody, Rt as Lakehouse, Ut as TransportResponse, Vt as OutputOf, bt as IsUnion, q as HistoryMode, xt as KnownRecord } from "./contract.js";
2
+ import { D as RoutedMessage, E as MessageTransport, S as MessageOutput, l as DataAppAnnotationDraft, n as ExternalLinkModifiers, r as ExternalLinkResult, w as MessageRoutes, x as MessageInput } from "./contract2.js";
2
3
  //#region src/core/logger.d.ts
3
4
  /** Host-owned log sink; compatible with console and frontend createLogger(). */
4
5
  type DataAppLogger = {
@@ -236,5 +237,16 @@ type Diagnostics = {
236
237
  };
237
238
  declare const appDiagnostics: Diagnostics;
238
239
  //#endregion
239
- export { DataAppLogger as C, createHttpTransport as S, DataClientOptions as _, createAnnotationClient as a, DataAppError as b, createDataAppNavigation as c, createIframeTransport as d, getDataAppTransport as f, DataClient as g, DataAppLocation as h, parseAppDiagnosticReport as i, getDataAppNavigation as l, localFrameBridge as m, AppDiagnosticReport as n, createMessageClient as o, installDataAppTransport as p, AppFailure as r, DataAppNavigation as s, appDiagnostics as t, IframeTransport as u, DataResponse as v, LogEntry as w, DataTransport as x, createDataClient as y };
240
+ //#region src/client/external-link.d.ts
241
+ type NavigationOptions = {
242
+ signal?: AbortSignal;
243
+ };
244
+ /** Request a new tab through the host, or open directly when standalone. Browser settings determine placement. */
245
+ declare function navigateNewTab(url: string, options?: NavigationOptions): Promise<ExternalLinkResult>;
246
+ /** Request a separate window through the host, or a popup when standalone. Browser settings determine placement. */
247
+ declare function navigateNewWindow(url: string, options?: NavigationOptions): Promise<ExternalLinkResult>;
248
+ /** Send only modifier keys, never the DOM/React event. Shift requests a window, Ctrl/Cmd a tab; otherwise no navigation. */
249
+ declare function navigateNewWindowOrTab(url: string, event: ExternalLinkModifiers, options?: NavigationOptions): Promise<ExternalLinkResult>;
250
+ //#endregion
251
+ export { DataAppError as C, LogEntry as D, DataAppLogger as E, createDataClient as S, createHttpTransport as T, localFrameBridge as _, AppDiagnosticReport as a, DataClientOptions as b, createAnnotationClient as c, createDataAppNavigation as d, getDataAppNavigation as f, installDataAppTransport as g, getDataAppTransport as h, appDiagnostics as i, createMessageClient as l, createIframeTransport as m, navigateNewWindow as n, AppFailure as o, IframeTransport as p, navigateNewWindowOrTab as r, parseAppDiagnosticReport as s, navigateNewTab as t, DataAppNavigation as u, DataAppLocation as v, DataTransport as w, DataResponse as x, DataClient as y };
240
252
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- import { Et as AppLocation, _n as OutputOf, pn as InputOf } from "../chunks/contract.js";
2
- import { C as DataAppLogger, S as createHttpTransport, _ as DataClientOptions, a as createAnnotationClient, b as DataAppError, c as createDataAppNavigation, d as createIframeTransport, f as getDataAppTransport, g as DataClient, h as DataAppLocation, l as getDataAppNavigation, n as AppDiagnosticReport, o as createMessageClient, p as installDataAppTransport, r as AppFailure, s as DataAppNavigation, t as appDiagnostics, u as IframeTransport, v as DataResponse, x as DataTransport, y as createDataClient } from "../chunks/index.js";
3
- export { type AppDiagnosticReport, type AppFailure, type AppLocation, DataAppError, type DataAppLocation, type DataAppLogger, type DataAppNavigation, type DataClient, type DataClientOptions, type DataResponse, type DataTransport, type IframeTransport, type InputOf, type OutputOf, appDiagnostics, createAnnotationClient, createDataAppNavigation, createDataClient, createHttpTransport, createIframeTransport, createMessageClient, getDataAppNavigation, getDataAppTransport, installDataAppTransport };
1
+ import { K as AppLocation, Lt as InputOf, Vt as OutputOf } from "../chunks/contract.js";
2
+ import { C as DataAppError, E as DataAppLogger, S as createDataClient, T as createHttpTransport, a as AppDiagnosticReport, b as DataClientOptions, c as createAnnotationClient, d as createDataAppNavigation, f as getDataAppNavigation, g as installDataAppTransport, h as getDataAppTransport, i as appDiagnostics, l as createMessageClient, m as createIframeTransport, n as navigateNewWindow, o as AppFailure, p as IframeTransport, r as navigateNewWindowOrTab, t as navigateNewTab, u as DataAppNavigation, v as DataAppLocation, w as DataTransport, x as DataResponse, y as DataClient } from "../chunks/index.js";
3
+ export { type AppDiagnosticReport, type AppFailure, type AppLocation, DataAppError, type DataAppLocation, type DataAppLogger, type DataAppNavigation, type DataClient, type DataClientOptions, type DataResponse, type DataTransport, type IframeTransport, type InputOf, type OutputOf, appDiagnostics, createAnnotationClient, createDataAppNavigation, createDataClient, createHttpTransport, createIframeTransport, createMessageClient, getDataAppNavigation, getDataAppTransport, installDataAppTransport, navigateNewTab, navigateNewWindow, navigateNewWindowOrTab };
@@ -1,4 +1,5 @@
1
- import { $t as QueryDefinitions, Bt as DimensionSourceQueryName, L as defineOperation, M as OperationDefinition, Vt as SourceDimensionVariable, Xt as CheckedQueries, an as QueryRow, en as QueryField, in as QueryProjections, nn as QueryParameterValue, on as QuerySnapshot, sn as QueryValueType, tn as QueryParameter, zt as DimensionSourceConfig } from "../chunks/contract.js";
1
+ import { a as RelativeOffset, i as RelativeDateTime, n as DateTimeRange, o as RelativeUnit, r as RelativeAnchor, t as AbsoluteOrRelativeDateTime } from "../chunks/date-time-range.js";
2
+ import { At as QuerySnapshot, Ct as QueryDefinitions, Et as QueryParameterValue, Ot as QueryProjections, Tt as QueryParameter, at as DimensionSourceConfig, i as OperationDefinition, jt as QueryValueType, kt as QueryRow, l as defineOperation, ot as DimensionSourceQueryName, st as SourceDimensionVariable, wt as QueryField, yt as CheckedQueries } from "../chunks/contract.js";
2
3
  import { o as AppearanceOptions } from "../chunks/appearance.js";
3
4
  //#region src/core/config.d.ts
4
5
  export type DataAppConfig<Queries extends QueryDefinitions = QueryDefinitions> = {
@@ -49,9 +50,10 @@ export type DataAppDefinition<Queries extends QueryDefinitions = QueryDefinition
49
50
  * references, and callbacks. Extraction reads literals without executing app code.
50
51
  * TypeScript and runtime query rules own configuration validation.
51
52
  *
52
- * SQL passes unchanged to the backend, which interprets placeholders such as `$orgId`.
53
+ * Scalar placeholders pass to the backend. Datetime-range bound references ($period.from/to)
54
+ * expand to DuckDB timestamp expressions while the range is bound as JSON.
53
55
  * Declare each parameter's type and optional defaultValue.
54
- * Values are finite numbers, strings, booleans, or null, never SQL fragments or identifiers.
56
+ * Values are scalars or declared datetime ranges, never SQL fragments or identifiers.
55
57
  * Host queryParams supply protected values; callers cannot override them.
56
58
  */
57
59
  export declare function defineDataApp<const Queries extends QueryDefinitions>(config: DataAppConfig<Queries> & {
@@ -59,5 +61,5 @@ export declare function defineDataApp<const Queries extends QueryDefinitions>(co
59
61
  }): DataAppDefinition<Queries>;
60
62
  export declare function dataAppTitle(config: Pick<DataAppConfig, 'title' | 'scope'>): string;
61
63
  //#endregion
62
- export type { QueryDefinitions, QueryField, QueryParameter, QueryParameterValue, QueryProjections, QueryRow, QueryValueType };
64
+ export type { AbsoluteOrRelativeDateTime, DateTimeRange, QueryDefinitions, QueryField, QueryParameter, QueryParameterValue, QueryProjections, QueryRow, QueryValueType, RelativeAnchor, RelativeDateTime, RelativeOffset, RelativeUnit };
63
65
  //# sourceMappingURL=config.d.ts.map
@@ -1,2 +1,5 @@
1
- import { $t as QueryDefinitions, A as DateRangeContractOptions, At as BooleanSelection, B as parseDateRangeInput, C as dataAppRoutes, D as sqlQueryRoute, E as navigationUpdateRoute, F as connectionCheck, Ft as numberFilter, G as DimensionFilterOptions, H as parseLabel, I as defineDateRangeContract, J as DimensionOption, Kt as DateRange, L as defineOperation, Lt as parseBooleanSelection, M as OperationDefinition, Mt as NumberOperator, N as RegisteredQuery, Nt as NumberSelection, O as ConnectionOperation, Ot as NavigationUpdate, P as ReportingPeriod, Pt as booleanFilter, Q as DimensionVariable, R as defineQueryNames, Rt as parseNumberSelection, S as createMessageRouter, T as defineMessageRoute, U as parseTrue, Ut as variableInput, V as parseEmptyInput, W as previousDateRange, Y as DimensionSelection, _ as MessageRoutes, a as annotationEditorStateRoute, an as QueryRow, b as RoutedMessage, c as annotationUpdateRoute, cn as DataOperation, d as MessageContext, dn as DataQueryInput, en as QueryField, et as dimensionFilter, f as MessageDispatcher, fn as DisclosedQuery, g as MessageRoute, gn as OperationContracts, h as MessageOutput, hn as OperationContext, i as annotationDraftRoute, in as QueryProjections, it as parseFacetOptions, j as DateRangeRequest, jt as NumberFilter, k as DateRangeContract, kt as BooleanFilter, l as parseDataAppAnnotationDraft, ln as DataOperations, m as MessageInput, mn as Lakehouse, n as DataAppAnnotationDraft, nn as QueryParameterValue, nt as dimensionPredicate, o as annotationModeRoute, p as MessageHandlers, q as DimensionMember, r as DataAppAnnotationPresentation, rn as QueryParameters, rt as parseDimensionSelection, s as annotationSendRoute, sn as QueryValueType, t as DataSourceError, tn as QueryParameter, u as DataQueryRoute, un as DataQueryBody, v as MessageRoutingError, vn as QueryResult, w as defineDataQueryRoute, x as SqlQueryInput, y as MessageTransport, yn as TransportResponse, z as parseCount } from "../chunks/contract.js";
2
- export { type BooleanFilter, type BooleanSelection, type ConnectionOperation, type DataAppAnnotationDraft, type DataAppAnnotationPresentation, type DataOperation, type DataOperations, type DataQueryBody, type DataQueryInput, type DataQueryRoute, DataSourceError, type DateRangeContract, type DateRangeContractOptions, type DateRange as DateRangeInput, type DateRangeRequest, type DimensionFilterOptions, type DimensionMember, type DimensionOption, type DimensionSelection, type DimensionVariable, type DisclosedQuery, type Lakehouse, type MessageContext, type MessageDispatcher, type MessageHandlers, type MessageInput, type MessageOutput, type MessageRoute, type MessageRoutes, MessageRoutingError, type MessageTransport, type NavigationUpdate, type NumberFilter, type NumberOperator, type NumberSelection, type OperationContext, type OperationContracts, type OperationDefinition, type QueryDefinitions, type QueryField, type QueryParameter, type QueryParameterValue, type QueryParameters, type QueryProjections, type QueryResult, type QueryRow, type QueryValueType, type RegisteredQuery, type ReportingPeriod, type RoutedMessage, type SqlQueryInput, type TransportResponse, annotationDraftRoute, annotationEditorStateRoute, annotationModeRoute, annotationSendRoute, annotationUpdateRoute, booleanFilter, connectionCheck, createMessageRouter, dataAppRoutes, defineDataQueryRoute, defineDateRangeContract, defineMessageRoute, defineOperation, defineQueryNames, dimensionFilter, dimensionPredicate, navigationUpdateRoute, numberFilter, parseBooleanSelection, parseCount, parseDataAppAnnotationDraft, parseDateRangeInput, parseDimensionSelection, parseEmptyInput, parseFacetOptions, parseLabel, parseNumberSelection, parseTrue, previousDateRange, sqlQueryRoute, variableInput };
1
+ import { i as RelativeDateTime, n as DateTimeRange, s as ResolvedDateTimeRange, t as AbsoluteOrRelativeDateTime } from "../chunks/date-time-range.js";
2
+ import { $ as NumberSelection, Bt as OperationContracts, Ct as QueryDefinitions, D as parseDimensionSelection, Dt as QueryParameters, E as dimensionPredicate, Et as QueryParameterValue, Ft as DataQueryInput, Gt as DateTimeRangeRequest, Ht as QueryResult, It as DisclosedQuery, J as NavigationUpdate, Mt as DataOperation, Nt as DataOperations, O as parseFacetOptions, Ot as QueryProjections, Pt as DataQueryBody, Q as NumberOperator, Rt as Lakehouse, S as DimensionVariable, Tt as QueryParameter, Ut as TransportResponse, Wt as DateTimeRangeContract, X as BooleanSelection, Y as BooleanFilter, Z as NumberFilter, _ as DimensionMember, _t as dateTimeRangePresets, a as RegisteredQuery, c as defineDateRangeContract, d as parseCount, dt as DateTimeRangeComparisonSelection, et as booleanFilter, f as parseEmptyInput, ft as DateTimeRangeComparisonVariable, gt as DateTimeRangeVariableOptions, h as DimensionFilterOptions, ht as DateTimeRangeVariable, i as OperationDefinition, it as parseNumberSelection, jt as QueryValueType, kt as QueryRow, l as defineOperation, lt as variableInput, m as parseTrue, mt as DateTimeRangePreset, n as DateRangeContract, o as ReportingPeriod, p as parseLabel, pt as DateTimeRangeComparisonVariableOptions, r as DateRangeContractOptions, rt as parseBooleanSelection, s as connectionCheck, t as ConnectionOperation, tt as numberFilter, u as defineQueryNames, ut as DateTimeRangeComparisonRequest, v as DimensionOption, vt as dateTimeRangeVariable, w as dimensionFilter, wt as QueryField, y as DimensionSelection, zt as OperationContext } from "../chunks/contract.js";
3
+ import { a as resolveDateTimeRange, i as parseDateTimeRange, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, t as formatDateTimeBound } from "../chunks/date-time-range-value.js";
4
+ import { A as dataAppRoutes, C as MessageRoute, D as RoutedMessage, E as MessageTransport, F as dateTimeRangeSql, M as defineMessageRoute, N as navigationUpdateRoute, O as SqlQueryInput, P as sqlQueryRoute, S as MessageOutput, T as MessageRoutingError, _ as DataQueryRoute, a as OpenExternalLink, b as MessageHandlers, c as resolveExternalLinkTarget, d as annotationDraftRoute, f as annotationEditorStateRoute, g as parseDataAppAnnotationDraft, h as annotationUpdateRoute, i as ExternalLinkTarget, j as defineDataQueryRoute, k as createMessageRouter, l as DataAppAnnotationDraft, m as annotationSendRoute, n as ExternalLinkModifiers, o as openExternalLinkRoute, p as annotationModeRoute, r as ExternalLinkResult, s as parseExternalUrl, t as DataSourceError, u as DataAppAnnotationPresentation, v as MessageContext, w as MessageRoutes, x as MessageInput, y as MessageDispatcher } from "../chunks/contract2.js";
5
+ export { type AbsoluteOrRelativeDateTime, type BooleanFilter, type BooleanSelection, type ConnectionOperation, type DataAppAnnotationDraft, type DataAppAnnotationPresentation, type DataOperation, type DataOperations, type DataQueryBody, type DataQueryInput, type DataQueryRoute, DataSourceError, type DateRangeContract, type DateRangeContractOptions, type DateTimeRange, type DateTimeRangeComparisonRequest, type DateTimeRangeComparisonSelection, type DateTimeRangeComparisonVariable, type DateTimeRangeComparisonVariableOptions, type DateTimeRangeContract, type DateTimeRangePreset, type DateTimeRangeRequest, type DateTimeRangeVariable, type DateTimeRangeVariableOptions, type DimensionFilterOptions, type DimensionMember, type DimensionOption, type DimensionSelection, type DimensionVariable, type DisclosedQuery, type ExternalLinkModifiers, type ExternalLinkResult, type ExternalLinkTarget, type Lakehouse, type MessageContext, type MessageDispatcher, type MessageHandlers, type MessageInput, type MessageOutput, type MessageRoute, type MessageRoutes, MessageRoutingError, type MessageTransport, type NavigationUpdate, type NumberFilter, type NumberOperator, type NumberSelection, type OpenExternalLink, type OperationContext, type OperationContracts, type OperationDefinition, type QueryDefinitions, type QueryField, type QueryParameter, type QueryParameterValue, type QueryParameters, type QueryProjections, type QueryResult, type QueryRow, type QueryValueType, type RegisteredQuery, type RelativeDateTime, type ReportingPeriod, type ResolvedDateTimeRange, type RoutedMessage, type SqlQueryInput, type TransportResponse, annotationDraftRoute, annotationEditorStateRoute, annotationModeRoute, annotationSendRoute, annotationUpdateRoute, booleanFilter, connectionCheck, createMessageRouter, dataAppRoutes, dateTimeRangePresets, dateTimeRangeSql, dateTimeRangeVariable, defineDataQueryRoute, defineDateRangeContract, defineMessageRoute, defineOperation, defineQueryNames, dimensionFilter, dimensionPredicate, formatDateTimeBound, formatDateTimeRange, navigationUpdateRoute, numberFilter, openExternalLinkRoute, parseBooleanSelection, parseCount, parseDataAppAnnotationDraft, parseDateTimeBound, parseDateTimeRange, parseDimensionSelection, parseEmptyInput, parseExternalUrl, parseFacetOptions, parseLabel, parseNumberSelection, parseTrue, resolveDateTimeRange, resolveExternalLinkTarget, serializeDateTimeRange, sqlQueryRoute, variableInput };
@@ -1,3 +1,23 @@
1
+ import { a as RelativeOffset, i as RelativeDateTime, n as DateTimeRange, o as RelativeUnit, r as RelativeAnchor, t as AbsoluteOrRelativeDateTime } from "../chunks/date-time-range.js";
2
+ import { n as formatDateTimeRange } from "../chunks/date-time-range-value.js";
3
+ //#region src/core/date-time-range-parser.d.ts
4
+ type DateTimeRangeParseFailureReason = 'empty' | 'unrecognized' | 'invalid-range' | 'ambiguous';
5
+ type DateTimeRangeParserOptions = {
6
+ /** UTC-encoded reference fields for omitted dates/years. Defaults to the current UTC date/time. */
7
+ now?: Date;
8
+ };
9
+ type ParseDateTimeRangeResult = {
10
+ ok: true;
11
+ range: DateTimeRange;
12
+ normalizedInput: string;
13
+ parser: 'relative' | 'calendar-preset' | 'calendar-range' | 'unix' | 'chrono';
14
+ } | {
15
+ ok: false;
16
+ reason: DateTimeRangeParseFailureReason;
17
+ normalizedInput: string;
18
+ };
19
+ export declare function parseDateTimeRangeInput(input: string, options?: DateTimeRangeParserOptions): ParseDateTimeRangeResult;
20
+ //#endregion
1
21
  //#region src/core/date-format.d.ts
2
22
  /** Formatting for calendar dates and instants without implicit time-zone parsing. */
3
23
  type DateFormatOptions = {
@@ -63,5 +83,5 @@ export declare function formatPercent(ratio: number | null | undefined, options?
63
83
  maximumFractionDigits?: number;
64
84
  }): string;
65
85
  //#endregion
66
- export type { DateFormat, DateFormatOptions, DateTimeFormatOptions };
86
+ export { type AbsoluteOrRelativeDateTime, type DateFormat, type DateFormatOptions, type DateTimeFormatOptions, type DateTimeRange, type DateTimeRangeParseFailureReason, type DateTimeRangeParserOptions, type ParseDateTimeRangeResult, type RelativeAnchor, type RelativeDateTime, type RelativeOffset, type RelativeUnit, formatDateTimeRange };
67
87
  //# sourceMappingURL=format.d.ts.map
@@ -1,3 +1,4 @@
1
- import { $t as QueryDefinitions, an as QueryRow, en as QueryField, in as QueryProjections, nn as QueryParameterValue, sn as QueryValueType, tn as QueryParameter } from "./chunks/contract.js";
1
+ import { a as RelativeOffset, i as RelativeDateTime, n as DateTimeRange, o as RelativeUnit, r as RelativeAnchor, t as AbsoluteOrRelativeDateTime } from "./chunks/date-time-range.js";
2
+ import { Ct as QueryDefinitions, Et as QueryParameterValue, Ot as QueryProjections, Tt as QueryParameter, jt as QueryValueType, kt as QueryRow, wt as QueryField } from "./chunks/contract.js";
2
3
  import { DataAppConfig, DataAppDefinition, dataAppTitle, defineDataApp } from "./core/config.js";
3
- export { type DataAppConfig, type DataAppDefinition, type QueryDefinitions, type QueryField, type QueryParameter, type QueryParameterValue, type QueryProjections, type QueryRow, type QueryValueType, dataAppTitle, defineDataApp };
4
+ export { type AbsoluteOrRelativeDateTime, type DataAppConfig, type DataAppDefinition, type DateTimeRange, type QueryDefinitions, type QueryField, type QueryParameter, type QueryParameterValue, type QueryProjections, type QueryRow, type QueryValueType, type RelativeAnchor, type RelativeDateTime, type RelativeOffset, type RelativeUnit, dataAppTitle, defineDataApp };
@@ -1,5 +1,8 @@
1
- import { $ as createDimensionFilter, Ct as multiChoiceVariable, Dt as HistoryMode, Gt as DatePresetId, Ht as dimensionSource, It as numberOperatorLabels, Jt as inclusiveDays, K as DimensionFilterSettings, Kt as DateRange, St as defineAppVariables, Tt as validateChoiceOptions, Vt as SourceDimensionVariable, Wt as DatePreset, X as DimensionSelectionVariable, Yt as withinBounds, Z as DimensionValue, Zt as IsUnion, _t as SearchVariable, at as FacetVariable, bt as choiceVariable, ct as AppVariableValues, dt as ChoiceOption, ft as ChoiceVariable, gt as MultiChoiceVariable, ht as DateRangeVariableOptions, j as DateRangeRequest, lt as CheckedFacetContexts, mt as DateRangeVariable, ot as facetSource, pt as DateRangeSelection, qt as availableDatePresets, r as DataAppAnnotationPresentation, st as AppVariable, tt as dimensionMemberKey, ut as CheckedVariableDeclarations, vt as VariableCollection, wt as searchVariable, xt as dateRangeVariable, yt as VariablePresentation } from "./chunks/contract.js";
2
- import { i as parseAppDiagnosticReport, m as localFrameBridge, w as LogEntry } from "./chunks/index.js";
1
+ import { i as RelativeDateTime, n as DateTimeRange, o as RelativeUnit, t as AbsoluteOrRelativeDateTime } from "./chunks/date-time-range.js";
2
+ import { A as facetSource, B as VariablePresentation, C as createDimensionFilter, F as ChoiceOption, G as validateChoiceOptions, Gt as DateTimeRangeRequest, H as defineAppVariables, I as ChoiceVariable, L as MultiChoiceVariable, M as AppVariableValues, N as CheckedFacetContexts, P as CheckedVariableDeclarations, R as SearchVariable, St as MAX_QUERY_ROWS, T as dimensionMemberKey, U as multiChoiceVariable, V as choiceVariable, W as searchVariable, _t as dateTimeRangePresets, b as DimensionSelectionVariable, bt as IsUnion, ct as dimensionSource, dt as DateTimeRangeComparisonSelection, ft as DateTimeRangeComparisonVariable, g as DimensionFilterSettings, gt as DateTimeRangeVariableOptions, ht as DateTimeRangeVariable, j as AppVariable, k as FacetVariable, mt as DateTimeRangePreset, nt as numberOperatorLabels, pt as DateTimeRangeComparisonVariableOptions, q as HistoryMode, st as SourceDimensionVariable, ut as DateTimeRangeComparisonRequest, vt as dateTimeRangeVariable, x as DimensionValue, z as VariableCollection } from "./chunks/contract.js";
3
+ import { a as resolveDateTimeRange, i as parseDateTimeRange, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, t as formatDateTimeBound } from "./chunks/date-time-range-value.js";
4
+ import { u as DataAppAnnotationPresentation } from "./chunks/contract2.js";
5
+ import { D as LogEntry, _ as localFrameBridge, s as parseAppDiagnosticReport } from "./chunks/index.js";
3
6
  import { c as Theme } from "./chunks/appearance.js";
4
7
  //#region src/core/bridge.d.ts
5
8
  /** Data app delivery protocol. IDs identify a document, a shell session, and an individual call. */
@@ -292,7 +295,7 @@ type MetricValues = {
292
295
  previous?: number | null;
293
296
  };
294
297
  type MetricReading = DataReading<MetricValues & {
295
- period?: DateRangeRequest;
298
+ period?: DateTimeRangeRequest;
296
299
  }>;
297
300
  //#endregion
298
301
  //#region src/core/uuid.d.ts
@@ -308,5 +311,9 @@ export declare function readRequestBody(request: Request, maxBytes: number): Pro
308
311
  /** Separator for opaque composite keys, independent of URL and DOM ID formats. */
309
312
  export declare const KEY_SEPARATOR = ":";
310
313
  //#endregion
311
- export { type AppVariable, type AppVariableValues, type BridgeDiagnostic, type BridgeEventMessage, type CheckedFacetContexts, type CheckedVariableDeclarations, type ChoiceOption, type ChoiceVariable, type DataAppPresentation, type DataReading, type DataView, type DatePreset, type DatePresetId, type DateRange, type DateRangeSelection, type DateRangeVariable, type DateRangeVariableOptions, type DimensionFilterSettings, type DimensionSelectionVariable, type DimensionValue, type DisplayedSnapshot, type FacetVariable, type HistoryMode, type IsUnion, type MetricReading, type MetricValues, type MultiChoiceVariable, type SearchVariable, type SourceDimensionVariable, type VariableCollection, type VariablePresentation, availableDatePresets, choiceVariable, createDimensionFilter, dateRangeVariable, defineAppVariables, dimensionMemberKey, dimensionSource, facetSource, inclusiveDays, localFrameBridge, multiChoiceVariable, numberOperatorLabels, parseAppDiagnosticReport, searchVariable, validateChoiceOptions, withinBounds };
314
+ //#region src/core/time-units.d.ts
315
+ /** Fixed durations in UTC-rebased arithmetic; months and years are calendar-dependent. */
316
+ export declare const fixedUnitMilliseconds: Partial<Record<RelativeUnit, number>> & Record<'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK', number>;
317
+ //#endregion
318
+ export { type AbsoluteOrRelativeDateTime, type AppVariable, type AppVariableValues, type BridgeDiagnostic, type BridgeEventMessage, type CheckedFacetContexts, type CheckedVariableDeclarations, type ChoiceOption, type ChoiceVariable, type DataAppPresentation, type DataReading, type DataView, type DateTimeRange, type DateTimeRangeComparisonRequest, type DateTimeRangeComparisonSelection, type DateTimeRangeComparisonVariable, type DateTimeRangeComparisonVariableOptions, type DateTimeRangePreset, type DateTimeRangeVariable, type DateTimeRangeVariableOptions, type DimensionFilterSettings, type DimensionSelectionVariable, type DimensionValue, type DisplayedSnapshot, type FacetVariable, type HistoryMode, type IsUnion, MAX_QUERY_ROWS, type MetricReading, type MetricValues, type MultiChoiceVariable, type RelativeDateTime, type SearchVariable, type SourceDimensionVariable, type VariableCollection, type VariablePresentation, choiceVariable, createDimensionFilter, dateTimeRangePresets, dateTimeRangeVariable, defineAppVariables, dimensionMemberKey, dimensionSource, facetSource, formatDateTimeBound, formatDateTimeRange, localFrameBridge, multiChoiceVariable, numberOperatorLabels, parseAppDiagnosticReport, parseDateTimeBound, parseDateTimeRange, resolveDateTimeRange, searchVariable, serializeDateTimeRange, validateChoiceOptions };
312
319
  //# sourceMappingURL=internal.d.ts.map
@@ -1,9 +1,9 @@
1
- import { ln as DataOperations, mn as Lakehouse, rn as QueryParameters } from "../chunks/contract.js";
1
+ import { Dt as QueryParameters, Nt as DataOperations, Rt as Lakehouse } from "../chunks/contract.js";
2
2
  //#region src/server/handler.d.ts
3
3
  /** Authorization result for one viewer request. A hosted adapter must scope its lakehouse client. */
4
4
  type RequestAccess = {
5
5
  lakehouse: Lakehouse;
6
- /** Trusted values shared across queries; each query uses only its declared keys. */
6
+ /** Trusted values shared across queries; each query uses only its declared keys. Datetime ranges use serializeDateTimeRange(); they are decoded and validated before SQL binding. */
7
7
  queryParams?: QueryParameters;
8
8
  };
9
9
  /**
@@ -1,7 +1,7 @@
1
1
  # Author a data app
2
2
 
3
- Build an exploration that answers the user's question and a story of its strongest
4
- findings.
3
+ Use the SDK to connect queries, operations, views, and widgets. The app brief determines the content structure. Component examples do not prescribe
4
+ which sections or features every app must contain.
5
5
 
6
6
  ## Use release-matched starters
7
7
 
@@ -13,20 +13,26 @@ for the requested change. For a new app, use the starter supplied by the authori
13
13
  | ----------------------- | ------------------------------------------------------------------- |
14
14
  | Hosted / remote / cloud | `starter-data-app/index.tsx` |
15
15
  | Local | `starter-local-data-app` |
16
-
17
- The hosted starter is the canonical query → operation → context → view → dataset
18
- → widget → story example. Hosted apps stay in one file with public package imports
16
+ | Hosted metric | `starter-metric-data-app/index.tsx` |
17
+ | Hosted Finding | `starter-finding-data-app/index.tsx` |
18
+ | Local metric | `starter-local-metric-data-app` |
19
+ | Local Finding | `starter-local-finding-data-app` |
20
+
21
+ Choose the runtime and use case supplied by the app brief. Each starter is editable
22
+ source; replace fixture queries and sample content before publishing. The hosted starter demonstrates query → operation
23
+ → context → view → dataset → widget composition, including a story example.
24
+ Hosted apps stay in one file with public package imports
19
25
  and a literal `defineDataApp()` declaration. Local apps use the same composition
20
26
  with their existing server/client wiring. Replace fixture data and connectivity screens; edit
21
27
  app-owned files, not installed packages.
22
28
 
23
- ## Build the exploration
29
+ ## Connect data and components
24
30
 
25
31
  1. **Define the question and scope.** Inspect relevant fields, definitions, time
26
32
  coverage, and missing or incomplete observations. Establish the population,
27
33
  grain, measures, and comparison. Choose a chart that answers the question.
28
- 2. **Replace the starter queries and operation.** Keep supplied registry SQL
29
- unchanged; otherwise write queries against inspected data. Declare `params`
34
+ 2. **Replace the starter queries and operation.** Write queries
35
+ against inspected data and preserve supplied metric definitions. Declare `params`
30
36
  and result aliases in `projections`. Validate flat operation inputs, execute
31
37
  named queries with `query()`, and derive results from its typed rows.
32
38
  3. **Update context and bindings.** Describe definitions and coverage in the data
@@ -37,21 +43,45 @@ app-owned files, not installed packages.
37
43
  useful filters in `variables`; `<DataApp>` renders them. Use `defineTimeView()`
38
44
  for period-driven analysis and `defineDataView()` otherwise. Split views only
39
45
  for independent requests. Keep protected values such as `orgId` backend-owned.
40
- 5. **Compose the exploration.** Lead with the strongest supported finding and
41
- visible scope. Use `<Stack>` for sections, `<Grid>` for peers, and bound widgets
46
+ 5. **Compose the content.** Follow the app brief for section order and narrative.
47
+ Use `<Stack>` for sections, `<Grid>` for peers, and bound widgets
42
48
  from `@altertable/data-app-react`. Keep static explanations outside loading
43
49
  boundaries. Use app tabs only for distinct questions and widget `views` only
44
50
  for alternate representations of one dataset. Keep default appearance;
45
51
  customize when requested. Use custom UI only when bound components cannot
46
52
  express the requirement.
47
- 6. **Adapt the story.** Return one to four supported findings using the same
48
- bindings and displayed input as the exploration. Supply every distinct
49
- displayed dataset to `<DataApp datasets={...}>` for CSV export.
53
+ 6. **Connect shell features.** See [stories and export](stories-and-export.md)
54
+ for the current `<DataApp>` requirements and how to bind these features to the
55
+ displayed result. The app brief determines presentation content and export
56
+ coverage.
50
57
 
51
58
  Keep credentials, authorization, and enforced query limits in the host/backend.
52
59
  The starter supplies transport and mounting; change them only for an explicit
53
60
  integration task.
54
61
 
62
+ ## Link to external pages
63
+
64
+ Use `<ExternalLink>` for HTTPS destinations in widget content:
65
+
66
+ ```tsx
67
+ import { ExternalLink } from '@altertable/data-app-react';
68
+
69
+ function ReportLink() {
70
+ return (
71
+ <ExternalLink href="https://example.com/report">
72
+ View full report
73
+ </ExternalLink>
74
+ );
75
+ }
76
+ ```
77
+
78
+ For programmatic navigation, import `navigateNewTab`, `navigateNewWindow`, or
79
+ `navigateNewWindowOrTab` from `@altertable/data-app/client`. For example,
80
+ `navigateNewWindowOrTab(url, event)` accepts a DOM or React event: Shift requests
81
+ a window, Ctrl/Cmd requests a tab, and an unmodified event does nothing.
82
+
83
+ Embedded hosts must enable the [external link route](embed.md#external-links).
84
+
55
85
  ## Verify the app
56
86
 
57
87
  Run the authoring workflow's validation, then inspect the app:
@@ -60,7 +90,8 @@ Run the authoring workflow's validation, then inspect the app:
60
90
  Distinguish measured zero, missing values, and empty results.
61
91
  - Change filters and exercise loading, empty, error, refresh, and stale states.
62
92
  Narrative, scope, story, and export must agree with the displayed result.
63
- - Present the story and check exported columns, raw values, filename, and scope.
93
+ - For exposed presentation and export features, check the story, exported
94
+ columns, raw values, filename, and scope.
64
95
  - Review app-owned content for clipping and readability at its intended width.
65
96
  Check custom layout or CSS at narrow and wide widths; check custom colors in
66
97
  both themes.
@@ -84,6 +115,7 @@ Open only the section needed for a requirement the starter does not cover:
84
115
  | -------------------------------------------- | ----------------------------------------------------------------- |
85
116
  | Adding categorical, numeric, or time filters | [Variables](variables.md) |
86
117
  | Adding a chart or narrative binding | [Widgets](widgets.md) |
118
+ | Adding supplemental control hints | [Tooltips](ui.md#tooltips-and-explanations) |
87
119
  | Adding a detail destination | [Detail views](views.md#detail-destinations) |
88
120
  | Registering physical sources | [Source identifiers](data-context.md#register-source-identifiers) |
89
121
  | Customizing appearance or CSS | [Formatting](formatting-and-appearance.md), [styling](styling.md) |
@@ -1,13 +1,12 @@
1
- # Compose an exploration
1
+ # Compose data components
2
2
 
3
3
  Define the question, population, period, measures, and comparison before choosing
4
4
  widgets. A focused answer may need only a chart and a paragraph.
5
5
 
6
- ## Build a sequence of questions
6
+ ## Choose components
7
7
 
8
- Lead with the strongest supported result and visible scope. Give each section a
9
- question: what happened, when, where it differs, or what supports the finding.
10
- Omit sections that add no evidence.
8
+ The app brief determines the content and section order.
9
+ Choose components for the information each section needs to convey:
11
10
 
12
11
  | Element | Purpose |
13
12
  | --------- | ------------------------------------------------------ |
@@ -33,21 +32,3 @@ averaging subgroup rates.
33
32
  Derive claims from the [displayed result and its input](views.md#preserve-displayed-results).
34
33
  A claim about all channels may stop being valid after selecting one. Observed
35
34
  differences support investigation; they do not establish a cause.
36
-
37
- ## Example: where are we losing signups?
38
-
39
- Define funnel entry, completion window, and channel attribution. Compare
40
- populations with equal opportunity to complete and identify incomplete periods.
41
-
42
- | Question | Display |
43
- | ------------------------------------- | -------------------------------------------------------- |
44
- | How many starters complete? | Conversion versus a comparable prior period, with counts |
45
- | When does conversion change? | Trend with incomplete periods identified |
46
- | At which step and for which channels? | Funnel and channel comparisons with counts and rates |
47
- | What supports the comparison? | Table of counts, denominators, and rates |
48
-
49
- Use one view for these related datasets. Let dates select funnel entry dates and
50
- channel filters affect every section. Reuse datasets for charts and tables.
51
- Select one to four supported findings for the [story](stories-and-export.md).
52
- Verify that changing a filter updates every claim and preserves a useful reading
53
- order.