@altertable/data-app 0.77.0 → 0.78.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 (68) hide show
  1. package/CONTRIBUTING.md +3 -0
  2. package/REFERENCE.md +45 -37
  3. package/dist/chunks/contract-gu1rDsV0.js +1588 -0
  4. package/dist/chunks/contract-gu1rDsV0.js.map +1 -0
  5. package/dist/chunks/data-client-BMdL73Ab.js +122 -0
  6. package/dist/chunks/data-client-BMdL73Ab.js.map +1 -0
  7. package/dist/chunks/{date-time-range-value-CnlTr1U1.js → date-time-range-value-D-XfqVTT.js} +21 -24
  8. package/dist/chunks/date-time-range-value-D-XfqVTT.js.map +1 -0
  9. package/dist/chunks/{diagnostics-Dyj-rUsY.js → diagnostics-CX9SsU79.js} +240 -63
  10. package/dist/chunks/diagnostics-CX9SsU79.js.map +1 -0
  11. package/dist/chunks/record-Cr4Uk1K3.js +9 -0
  12. package/dist/chunks/record-Cr4Uk1K3.js.map +1 -0
  13. package/dist/client/index.js +4 -101
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/core/appearance.js +3 -5
  16. package/dist/core/appearance.js.map +1 -1
  17. package/dist/core/config.js +11 -3
  18. package/dist/core/config.js.map +1 -1
  19. package/dist/core/contract.js +3 -4
  20. package/dist/core/format.js +1 -1
  21. package/dist/internal.js +63 -11
  22. package/dist/internal.js.map +1 -1
  23. package/dist/types/chunks/contract.d.ts +254 -19
  24. package/dist/types/chunks/data-client.d.ts +46 -0
  25. package/dist/types/chunks/date-time-range-value.d.ts +28 -2
  26. package/dist/types/chunks/index.d.ts +65 -80
  27. package/dist/types/client/index.d.ts +4 -3
  28. package/dist/types/core/config.d.ts +10 -4
  29. package/dist/types/core/contract.d.ts +3 -5
  30. package/dist/types/core/format.d.ts +1 -2
  31. package/dist/types/index.d.ts +4 -4
  32. package/dist/types/internal.d.ts +25 -6
  33. package/docs/app-authoring.md +13 -9
  34. package/docs/client.md +14 -53
  35. package/docs/contract.md +35 -15
  36. package/docs/data-context.md +5 -2
  37. package/docs/diagnostics.md +16 -23
  38. package/docs/embed.md +60 -25
  39. package/docs/filters.md +33 -57
  40. package/docs/hosted-apps.md +9 -9
  41. package/docs/layout.md +21 -0
  42. package/docs/local-data-apps.md +5 -6
  43. package/docs/react-embed.md +44 -2
  44. package/docs/react.md +1 -2
  45. package/docs/server-bun.md +8 -5
  46. package/docs/stories-and-export.md +4 -4
  47. package/docs/styling.md +2 -1
  48. package/docs/ui.md +12 -3
  49. package/docs/views.md +12 -11
  50. package/docs/widgets.md +3 -3
  51. package/docs/worker.md +1 -1
  52. package/package.json +1 -5
  53. package/dist/chunks/contract-BQsFReRp.js +0 -780
  54. package/dist/chunks/contract-BQsFReRp.js.map +0 -1
  55. package/dist/chunks/contract-VhY9V9wd.js +0 -806
  56. package/dist/chunks/contract-VhY9V9wd.js.map +0 -1
  57. package/dist/chunks/date-time-range-value-CnlTr1U1.js.map +0 -1
  58. package/dist/chunks/diagnostics-Dyj-rUsY.js.map +0 -1
  59. package/dist/chunks/operation-BVRM-A5Y.js +0 -134
  60. package/dist/chunks/operation-BVRM-A5Y.js.map +0 -1
  61. package/dist/chunks/request-body-H1qPmmTN.js +0 -50
  62. package/dist/chunks/request-body-H1qPmmTN.js.map +0 -1
  63. package/dist/server/index.js +0 -90
  64. package/dist/server/index.js.map +0 -1
  65. package/dist/types/chunks/contract2.d.ts +0 -221
  66. package/dist/types/chunks/date-time-range.d.ts +0 -29
  67. package/dist/types/server/index.d.ts +0 -17
  68. package/docs/server.md +0 -41
@@ -2,7 +2,7 @@
2
2
 
3
3
  The bound `<DataApp>` from `@altertable/data-app-react` accepts an optional `story`
4
4
  callback and optional nonempty `datasets` list. Omit either prop to omit its toolbar
5
- control. Supplied features use the displayed snapshot, including during refresh or
5
+ control, or the matching [page action](embed.md#page-actions) when embedded. Supplied features use the displayed snapshot, including during refresh or
6
6
  failure. A story callback returning `[]` leaves a disabled presentation action.
7
7
  Set `showToolbar={false}` to omit page actions together; data loading, error states,
8
8
  and declared filters remain available. Setup and static screens can use `<DataApp>`
@@ -14,8 +14,8 @@ explanatory prose in the app body.
14
14
 
15
15
  ## Present data with stories
16
16
 
17
- Continue the starter's `totalSamples` binding. Return one to four findings with a
18
- headline, visual, and registered dataset or
17
+ This example adds a story to the sample-count bindings in [widgets](widgets.md).
18
+ Return one to four findings with a headline, visual, and registered dataset or
19
19
  metric as `evidence`. The story receives `view`'s displayed snapshot, then one
20
20
  snapshot per entry in `summaryViews`. Reuse each binding with its own view's
21
21
  snapshot and derive scope from it:
@@ -53,7 +53,7 @@ function App() {
53
53
  List a view in `summaryViews` only when the story or export reads it: summary
54
54
  views load with the page instead of when their sections near the viewport.
55
55
 
56
- Keep the starter's `formatMetric()` import for formatted headlines.
56
+ Import `formatMetric()` from `@altertable/data-app/format` for formatted headlines.
57
57
 
58
58
  ## Export displayed data as CSV
59
59
 
package/docs/styling.md CHANGED
@@ -3,7 +3,8 @@
3
3
  Keep default appearance unless customization is requested. Use components and
4
4
  typed props first. Configure appearance once through
5
5
  `dataApp.appearance`; see [formatting and appearance](formatting-and-appearance.md).
6
- Call `injectDataAppStyles()` before mounting and use one `<DataApp>` per document.
6
+ `mountDataApp()` installs styles. When mounting `DataAppProvider` yourself, call
7
+ `injectDataAppStyles()` first. Use one `<DataApp>` per document.
7
8
 
8
9
  ## Customize
9
10
 
package/docs/ui.md CHANGED
@@ -20,8 +20,8 @@ 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
25
 
26
26
  ## Tooltips and explanations
27
27
 
@@ -53,7 +53,7 @@ function ExportActions({ exportRows }: { exportRows: () => void }) {
53
53
  }
54
54
  ```
55
55
 
56
- `<AppLayout>` already provides shared timing. A standalone `<Tooltip>` works
56
+ A standalone `<Tooltip>` works
57
57
  without a provider; wrap adjacent custom controls in `<TooltipProvider>` to share
58
58
  the first-hover delay and open subsequent hints immediately. Keyboard focus opens
59
59
  hints immediately. The pointer can move onto the hint to keep it visible; Escape
@@ -153,6 +153,15 @@ so rows, loading state, evidence, and inspection come from that dataset.
153
153
  Pass ordered items with unique, nonblank IDs and finite numbers. Bar and pie
154
154
  values must be nonnegative. Use `formatValue` for domain formatting.
155
155
 
156
+ Use `showYAxis` on interactive bar charts when readers need a numeric scale,
157
+ including counts, ratios, and monetary amounts. Keep category names in the labels.
158
+ Match `valueFormat` to the measure: `{ kind: 'count' }`, `{ kind: 'ratio' }`
159
+ (fractions displayed as percentages), or `{ kind: 'currency', currency: 'USD' }`.
160
+ The format applies consistently to the axis and tooltips. For other units, use
161
+ the default number scale and name the unit in the chart title; `formatValue`
162
+ customizes inspected values. For ranked categories, use `scrollToEnd={false}`
163
+ to begin with the leading item; the default keeps the latest samples in view.
164
+
156
165
  Line and area charts space samples equally; include missing periods and use
157
166
  composed charts for irregular intervals. Distinguish missing observations from zero.
158
167
  Pie slices represent mutually exclusive parts of one total; shares
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
 
@@ -41,12 +42,12 @@ The view's filters, reporting period, metric comparisons, and scope come from
41
42
  the [filters](filters.md) its operation declares. Set `describeInput` only when
42
43
  the derived scope needs specific copy.
43
44
 
44
- ## Give each widget its own view
45
+ ## Give each independent result its own view
45
46
 
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:
47
+ In this example, the total and group counts are independent results with separate
48
+ operations and views. `<DataApp view>` loads with the page; other views load when
49
+ their sections near the viewport unless listed in `summaryViews`. Both operations
50
+ read the same `groupName` filter, and `<DataApp>` renders its control once:
50
51
 
51
52
  ```tsx
52
53
  // ... client, operations, sampleDataContext, and section contents
@@ -79,9 +80,9 @@ Define every view rendered inside one `<DataApp>` from the same
79
80
  `createDataHooks()` result; its client owns their filter controls.
80
81
 
81
82
  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).
83
+ in one view when they show the same result, such as a chart and the table
84
+ of its rows, or related metrics derived from one summary. A story or export that
85
+ reads other views lists them in [`summaryViews`](stories-and-export.md).
85
86
 
86
87
  ## Preserve displayed results
87
88
 
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.
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.78.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"