@altertable/data-app 0.77.0 → 0.79.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 (70) hide show
  1. package/AGENTS.md +3 -0
  2. package/CONTRIBUTING.md +5 -1
  3. package/REFERENCE.md +70 -180
  4. package/dist/chunks/contract-BTG-BUwW.js +1589 -0
  5. package/dist/chunks/contract-BTG-BUwW.js.map +1 -0
  6. package/dist/chunks/data-client-C4Pay-UE.js +122 -0
  7. package/dist/chunks/data-client-C4Pay-UE.js.map +1 -0
  8. package/dist/chunks/{date-time-range-value-CnlTr1U1.js → date-time-range-value-D-XfqVTT.js} +21 -24
  9. package/dist/chunks/date-time-range-value-D-XfqVTT.js.map +1 -0
  10. package/dist/chunks/{diagnostics-Dyj-rUsY.js → diagnostics-BwpM9wGn.js} +240 -63
  11. package/dist/chunks/diagnostics-BwpM9wGn.js.map +1 -0
  12. package/dist/chunks/record-Cr4Uk1K3.js +9 -0
  13. package/dist/chunks/record-Cr4Uk1K3.js.map +1 -0
  14. package/dist/client/index.js +4 -101
  15. package/dist/client/index.js.map +1 -1
  16. package/dist/core/appearance.js +3 -5
  17. package/dist/core/appearance.js.map +1 -1
  18. package/dist/core/config.js +12 -3
  19. package/dist/core/config.js.map +1 -1
  20. package/dist/core/contract.js +3 -4
  21. package/dist/core/format.js +1 -1
  22. package/dist/internal.js +63 -11
  23. package/dist/internal.js.map +1 -1
  24. package/dist/types/chunks/contract.d.ts +260 -20
  25. package/dist/types/chunks/data-client.d.ts +46 -0
  26. package/dist/types/chunks/date-time-range-value.d.ts +28 -2
  27. package/dist/types/chunks/index.d.ts +65 -80
  28. package/dist/types/client/index.d.ts +4 -3
  29. package/dist/types/core/config.d.ts +13 -4
  30. package/dist/types/core/contract.d.ts +3 -5
  31. package/dist/types/core/format.d.ts +1 -2
  32. package/dist/types/index.d.ts +4 -4
  33. package/dist/types/internal.d.ts +25 -6
  34. package/docs/app-authoring.md +160 -72
  35. package/docs/client.md +14 -53
  36. package/docs/contract.md +47 -26
  37. package/docs/data-context.md +11 -11
  38. package/docs/diagnostics.md +16 -23
  39. package/docs/embed.md +60 -25
  40. package/docs/filters.md +39 -65
  41. package/docs/formatting-and-appearance.md +2 -5
  42. package/docs/hosted-apps.md +11 -11
  43. package/docs/layout.md +21 -0
  44. package/docs/local-data-apps.md +10 -7
  45. package/docs/react-embed.md +44 -2
  46. package/docs/react.md +2 -5
  47. package/docs/server-bun.md +8 -5
  48. package/docs/stories-and-export.md +5 -6
  49. package/docs/styling.md +2 -1
  50. package/docs/ui.md +37 -10
  51. package/docs/views.md +18 -19
  52. package/docs/widgets.md +10 -11
  53. package/docs/worker.md +1 -1
  54. package/package.json +1 -5
  55. package/dist/chunks/contract-BQsFReRp.js +0 -780
  56. package/dist/chunks/contract-BQsFReRp.js.map +0 -1
  57. package/dist/chunks/contract-VhY9V9wd.js +0 -806
  58. package/dist/chunks/contract-VhY9V9wd.js.map +0 -1
  59. package/dist/chunks/date-time-range-value-CnlTr1U1.js.map +0 -1
  60. package/dist/chunks/diagnostics-Dyj-rUsY.js.map +0 -1
  61. package/dist/chunks/operation-BVRM-A5Y.js +0 -134
  62. package/dist/chunks/operation-BVRM-A5Y.js.map +0 -1
  63. package/dist/chunks/request-body-H1qPmmTN.js +0 -50
  64. package/dist/chunks/request-body-H1qPmmTN.js.map +0 -1
  65. package/dist/server/index.js +0 -90
  66. package/dist/server/index.js.map +0 -1
  67. package/dist/types/chunks/contract2.d.ts +0 -221
  68. package/dist/types/chunks/date-time-range.d.ts +0 -29
  69. package/dist/types/server/index.d.ts +0 -17
  70. package/docs/server.md +0 -41
package/docs/ui.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Direct UI composition
2
2
 
3
- Import from `@altertable/data-app-react/ui` for setup/static screens, custom
4
- controls, or a deliberately custom shell. For data-backed content, prefer declared views
3
+ Import from `@altertable/data-app-react/ui` for charts, custom controls, or a
4
+ deliberately custom shell. For data-backed content, prefer declared views
5
5
  and bound widgets from `@altertable/data-app-react`.
6
6
 
7
- `<DataApp>` here renders a static screen and accepts optional direct CSV data.
8
- Direct widget forms accept local values or rows. `<DataWidget>` supplies a generic
7
+ `<DataApp>` from `@altertable/data-app-react` renders a setup or static screen
8
+ when it has a `dataContext` and no `view`. `<DataWidget>` supplies a generic
9
9
  frame for deliberately custom content. Use `<GettingStarted>` for
10
10
  connection setup. Fetched data belongs to a declared view; avoid inventing
11
11
  request states to populate a shell.
@@ -20,8 +20,27 @@ derive findings from the displayed data. Standard widgets and `<DataApp>`
20
20
  already own these experiences.
21
21
 
22
22
  For framework mounting, `<DataAppProvider app={dataApp}>` supplies app identity, shared requests and one inspection sheet. Wrap custom shells in it; app components inherit identity and appearance.
23
- Call `injectDataAppStyles()` before mounting either entry; imports do not install
24
- styles.
23
+ `mountDataApp()` installs styles. For a custom root using `DataAppProvider`, call
24
+ `injectDataAppStyles()` before mounting; imports do not install styles.
25
+
26
+ ## External links
27
+
28
+ Use `<ExternalLink>` for HTTPS destinations in widget content:
29
+
30
+ ```tsx
31
+ import { ExternalLink } from '@altertable/data-app-react';
32
+
33
+ function ReportLink() {
34
+ return (
35
+ <ExternalLink href="https://example.com/report">
36
+ View full report
37
+ </ExternalLink>
38
+ );
39
+ }
40
+ ```
41
+
42
+ For programmatic navigation, import `navigateNewTab`, `navigateNewWindow`, or
43
+ `navigateNewWindowOrTab` from `@altertable/data-app/client`.
25
44
 
26
45
  ## Tooltips and explanations
27
46
 
@@ -53,7 +72,7 @@ function ExportActions({ exportRows }: { exportRows: () => void }) {
53
72
  }
54
73
  ```
55
74
 
56
- `<AppLayout>` already provides shared timing. A standalone `<Tooltip>` works
75
+ A standalone `<Tooltip>` works
57
76
  without a provider; wrap adjacent custom controls in `<TooltipProvider>` to share
58
77
  the first-hover delay and open subsequent hints immediately. Keyboard focus opens
59
78
  hints immediately. The pointer can move onto the hint to keep it visible; Escape
@@ -153,6 +172,15 @@ so rows, loading state, evidence, and inspection come from that dataset.
153
172
  Pass ordered items with unique, nonblank IDs and finite numbers. Bar and pie
154
173
  values must be nonnegative. Use `formatValue` for domain formatting.
155
174
 
175
+ Use `showYAxis` on interactive bar charts when readers need a numeric scale,
176
+ including counts, ratios, and monetary amounts. Keep category names in the labels.
177
+ Match `valueFormat` to the measure: `{ kind: 'count' }`, `{ kind: 'ratio' }`
178
+ (fractions displayed as percentages), or `{ kind: 'currency', currency: 'USD' }`.
179
+ The format applies consistently to the axis and tooltips. For other units, use
180
+ the default number scale and name the unit in the chart title; `formatValue`
181
+ customizes inspected values. For ranked categories, use `scrollToEnd={false}`
182
+ to begin with the leading item; the default keeps the latest samples in view.
183
+
156
184
  Line and area charts space samples equally; include missing periods and use
157
185
  composed charts for irregular intervals. Distinguish missing observations from zero.
158
186
  Pie slices represent mutually exclusive parts of one total; shares
@@ -176,9 +204,8 @@ conversion windows, and cohort definitions; these components visualize results.
176
204
  - `<JourneyChart>`: full ordered paths with counts and outcomes; preserve repeated
177
205
  events and mark cut-off paths as `truncated`.
178
206
 
179
- See the [complete component examples](https://github.com/altertable-ai/data-app/blob/main/dev/fixtures/gallery-basics.tsx)
180
- for input shapes and composition. Read the exported types and JSDoc for exact
181
- constraints before adapting displayed rows.
207
+ Search [REFERENCE.md](../REFERENCE.md) for `FunnelChartSeries`,
208
+ `RetentionChartPoint`, and `JourneyChartPath` before adapting displayed rows.
182
209
 
183
210
  ### Composed charts
184
211
 
package/docs/views.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Views and displayed results
2
2
 
3
- Keep the starter's client and hooks. Define one view per operation, and one
4
- operation per widget. The examples continue the hosted starter's
5
- `sampleCountsByGroup` operation and `sampleDataContext`.
3
+ Keep the starter's client and hooks. Define one view per operation. Widgets may
4
+ share a view when they show the same rows or related metrics from one summary.
5
+ The examples below use sample-count operations and bindings to illustrate the
6
+ contracts; keep the selected starter's domain names when adapting its source.
6
7
 
7
8
  ## Bind a view
8
9
 
@@ -20,7 +21,6 @@ const { defineView } = createDataHooks(client);
20
21
  const sampleCountsView = defineView({
21
22
  dataContext: sampleDataContext,
22
23
  operation: 'sampleCountsByGroup',
23
- isEmpty: rows => rows.length === 0,
24
24
  emptyFallback: { title: 'No matching groups' },
25
25
  });
26
26
  // ... sampleCounts dataset and story callback
@@ -41,12 +41,12 @@ The view's filters, reporting period, metric comparisons, and scope come from
41
41
  the [filters](filters.md) its operation declares. Set `describeInput` only when
42
42
  the derived scope needs specific copy.
43
43
 
44
- ## Give each widget its own view
44
+ ## Give each independent result its own view
45
45
 
46
- The hosted starter gives its total and its group counts separate operations and
47
- views. `<DataApp view>` loads with the page; every other `<DataSection>` loads
48
- when it nears the viewport. Both operations read the same `groupName` filter,
49
- and `<DataApp>` renders its control once:
46
+ In this example, the total and group counts are independent results with separate
47
+ operations and views. `<DataApp view>` loads with the page; other views load when
48
+ their sections near the viewport unless listed in `summaryViews`. Both operations
49
+ read the same `groupName` filter, and `<DataApp>` renders its control once:
50
50
 
51
51
  ```tsx
52
52
  // ... client, operations, sampleDataContext, and section contents
@@ -55,7 +55,6 @@ const { defineView } = createDataHooks(client);
55
55
  const sampleCountsView = defineView({
56
56
  dataContext: sampleDataContext,
57
57
  operation: 'sampleCountsByGroup',
58
- isEmpty: rows => rows.length === 0,
59
58
  emptyFallback: { title: 'No matching groups' },
60
59
  });
61
60
  const sampleTotalView = defineView({
@@ -79,9 +78,9 @@ Define every view rendered inside one `<DataApp>` from the same
79
78
  `createDataHooks()` result; its client owns their filter controls.
80
79
 
81
80
  Share one [data context](data-context.md) across the app's views. Group widgets
82
- in one view only when they show the same result, such as a chart and the table
83
- of its rows. A story or export that reads other views lists them in
84
- [`summaryViews`](stories-and-export.md).
81
+ in one view when they show the same result, such as a chart and the table
82
+ of its rows, or related metrics derived from one summary. A story or export that
83
+ reads other views lists them in [`summaryViews`](stories-and-export.md).
85
84
 
86
85
  ## Preserve displayed results
87
86
 
@@ -91,8 +90,10 @@ refresh or failure. Use `result.scope` in content and `view.scope(snapshot)` in
91
90
  stories. Let views and bound widgets own request state and loading feedback.
92
91
  Keep static introductions outside loading boundaries.
93
92
 
94
- A measured zero is valid data. Set `isEmpty` and useful `emptyFallback` copy when
95
- a result can be empty; omit both when it never is, such as a total.
93
+ A measured zero is valid data. A view whose operation returns no rows is empty;
94
+ give it useful `emptyFallback` copy. Set `isEmpty` for any other result that can
95
+ be empty, such as a nullable summary, and omit both for one that never is, such
96
+ as a total.
96
97
 
97
98
  ## Detail destinations
98
99
 
@@ -110,16 +111,14 @@ const groupView = defineDetailView({
110
111
  dataContext: sampleDataContext,
111
112
  parseInput: operations.sampleCountsByGroup.input,
112
113
  describeInput: ({ groupName }) => `group ${groupName}`,
113
- isEmpty: rows => rows.length === 0,
114
114
  emptyFallback: { title: 'No matching group' },
115
115
  });
116
116
  const groupCounts = groupView.dataset({
117
117
  name: 'Group counts',
118
- select: rows => rows,
119
118
  rowKey: row => row.groupName,
120
119
  columns: {
121
- groupName: { value: row => row.groupName },
122
- sampleCount: { value: row => row.sampleCount, format: { kind: 'count' } },
120
+ groupName: {},
121
+ sampleCount: { format: { kind: 'count' } },
123
122
  },
124
123
  evidence: { id: 'group-counts', glossaryIds: ['sampleCount'] },
125
124
  });
package/docs/widgets.md CHANGED
@@ -24,7 +24,7 @@ only when changing spans or shell composition.
24
24
  Choose the component by the user's question. Compose dataset visuals inside
25
25
  `<VisualizationWidget>`; use `<MetricWidget>` for a headline value. Built-in
26
26
  charts come from `@altertable/data-app-react/ui`; `<Ranking>`, `<Breakdown>`, and `<Comparison>`
27
- are also available from `@altertable/data-app-react`.
27
+ come from the root `@altertable/data-app-react` entry.
28
28
 
29
29
  | Question | Component and constraint |
30
30
  | -------------------------------- | ------------------------------------------------------------------------------- |
@@ -48,8 +48,8 @@ values available in a table when they matter.
48
48
 
49
49
  ## Declare datasets and metrics
50
50
 
51
- Continue the starter's `sampleCountsView` and `sampleTotalView`. Use `<BarChart>` from
52
- `@altertable/data-app-react/ui`.
51
+ The sample-count example below uses the views from [views](views.md).
52
+ Use `<BarChart>` from `@altertable/data-app-react/ui`.
53
53
  Bind reusable selections to the view whose operation returns them. Declare evidence references directly;
54
54
  the view validates them against its own context. A dataset's columns supply both formatted
55
55
  table cells and raw CSV values. Widgets derive their readings, evidence, and empty fallback from the binding.
@@ -61,12 +61,11 @@ only when the view's operation reads a `dateTimeRangeFilter()` with
61
61
  // ... sampleCountsView, sampleTotalView, and imports
62
62
  const sampleCounts = sampleCountsView.dataset({
63
63
  name: 'Sample counts',
64
- select: rows => rows,
65
64
  rowKey: row => row.groupName,
66
65
  evidence: { id: 'counts-by-group', glossaryIds: ['sampleCount'] },
67
66
  columns: {
68
- groupName: { label: 'Group', value: row => row.groupName },
69
- sampleCount: { value: row => row.sampleCount, format: { kind: 'count' } },
67
+ groupName: { label: 'Group' },
68
+ sampleCount: { format: { kind: 'count' } },
70
69
  },
71
70
  });
72
71
  const totalSamples = sampleTotalView.metric(
@@ -106,8 +105,11 @@ const countsContent = sampleCountsView.content(result => (
106
105
  Render each content in its own `<DataSection>`.
107
106
 
108
107
  Column keys supply IDs and default labels; set `label` for a different header.
109
- Keep row keys stable and unique. Custom cells use `format: row => ...`; CSV uses
110
- the raw `value` accessor. Metric comparisons require that reporting period.
108
+ A column named after a row field reads that field. Set `value` for a computed
109
+ column, such as `{ value: row => row.revenue / row.orders }`, and `select` when
110
+ the operation returns an object rather than its rows, such as
111
+ `select: summary => summary.rows`. Keep row keys stable and unique. Custom cells
112
+ use `format: row => ...`; CSV exports the raw value. Metric comparisons require that reporting period.
111
113
  Reuse bindings in stories with the snapshot of the view that owns them.
112
114
 
113
115
  Tables search and paginate only supplied rows. Use query-backed pagination with a
@@ -144,9 +146,6 @@ The dataset owns evidence and empty copy; an empty row selection shows that fall
144
146
  alternate-view selection shared with its inspection sheet. Give views stable IDs
145
147
  and keep interactive state above the widget, since inspection may render it again.
146
148
 
147
- Use custom controls, tables, or overlays only when bound components cannot
148
- express the requirement; see [direct UI composition](ui.md).
149
-
150
149
  ## Exploration actions
151
150
 
152
151
  Declare actions on their dataset or metric and pass them to its widget. A detail
package/docs/worker.md CHANGED
@@ -36,7 +36,7 @@ Exact entries must be bare HTTP(S) origins. Keep an exact origin first for the
36
36
  default parent.
37
37
 
38
38
  The Worker sets CSP and trusted frame ancestors. Data queries use the
39
- [host's authorized SQL route](embed.md#sql-query-route); the Worker does not
39
+ [host's registered query route](embed.md#registered-query-route); the Worker does not
40
40
  execute queries.
41
41
 
42
42
  For file-based deployment tools such as Terraform, copy the resolved asset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altertable/data-app",
3
- "version": "0.77.0",
3
+ "version": "0.79.0",
4
4
  "description": "Portable definitions, contracts, formatting, browser clients, and request handlers for Altertable data apps.",
5
5
  "keywords": [
6
6
  "altertable",
@@ -70,10 +70,6 @@
70
70
  "types": "./dist/types/client/index.d.ts",
71
71
  "import": "./dist/client/index.js"
72
72
  },
73
- "./server": {
74
- "types": "./dist/types/server/index.d.ts",
75
- "import": "./dist/server/index.js"
76
- },
77
73
  "./internal": {
78
74
  "types": "./dist/types/internal.d.ts",
79
75
  "import": "./dist/internal.js"