@altertable/data-app 0.69.0 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/AGENTS.md +11 -1
  2. package/CONTRIBUTING.md +59 -26
  3. package/README.md +22 -26
  4. package/REFERENCE.md +1900 -0
  5. package/dist/chunks/index-5a27erdg.js +54 -0
  6. package/dist/chunks/index-5a27erdg.js.map +10 -0
  7. package/dist/chunks/{index-2sbp9h2b.js → index-9yxr7nmm.js} +330 -21
  8. package/dist/chunks/index-9yxr7nmm.js.map +17 -0
  9. package/dist/chunks/{index-r7b1ftwy.js → index-j5q5n3ra.js} +8 -6
  10. package/dist/chunks/index-j5q5n3ra.js.map +10 -0
  11. package/dist/chunks/{index-22d576sn.js → index-q75zm3a7.js} +3 -3
  12. package/dist/chunks/{index-22d576sn.js.map → index-q75zm3a7.js.map} +3 -3
  13. package/dist/chunks/{index-kwnqycjt.js → index-vhaec7m5.js} +8 -6
  14. package/dist/chunks/index-vhaec7m5.js.map +10 -0
  15. package/dist/chunks/index-zp78caex.js +1047 -0
  16. package/dist/chunks/index-zp78caex.js.map +19 -0
  17. package/dist/client/index.js +284 -16
  18. package/dist/client/index.js.map +7 -3
  19. package/dist/core/appearance.js +181 -11
  20. package/dist/core/appearance.js.map +4 -3
  21. package/dist/core/config.js +3 -3
  22. package/dist/core/contract.js +13 -15
  23. package/dist/core/contract.js.map +1 -1
  24. package/dist/core/format.js +1 -1
  25. package/dist/index.js +4 -4
  26. package/dist/index.js.map +1 -1
  27. package/dist/internal.js +418 -0
  28. package/dist/internal.js.map +15 -0
  29. package/dist/server/index.js +102 -0
  30. package/dist/server/index.js.map +10 -0
  31. package/dist/types/client/annotations.d.ts +1 -1
  32. package/dist/types/client/data-client.d.ts +21 -10
  33. package/dist/types/client/iframe.d.ts +6 -6
  34. package/dist/types/client/index.d.ts +3 -4
  35. package/dist/types/client/location.d.ts +2 -2
  36. package/dist/types/client/logger.d.ts +1 -1
  37. package/dist/types/client/navigation.d.ts +1 -1
  38. package/dist/types/client/transport.d.ts +1 -1
  39. package/dist/types/core/bridge.d.ts +1 -1
  40. package/dist/types/core/config.d.ts +20 -17
  41. package/dist/types/core/contract.d.ts +23 -13
  42. package/dist/types/core/dimension-source.d.ts +64 -0
  43. package/dist/types/core/dimension.d.ts +31 -23
  44. package/dist/types/core/facets.d.ts +13 -0
  45. package/dist/types/core/filters.d.ts +1 -1
  46. package/dist/types/core/format.d.ts +1 -2
  47. package/dist/types/core/keys.d.ts +2 -0
  48. package/dist/types/core/messages.d.ts +3 -3
  49. package/dist/types/core/operation-types.d.ts +7 -6
  50. package/dist/types/core/presentation.d.ts +1 -1
  51. package/dist/types/core/queries.d.ts +75 -7
  52. package/dist/types/core/reading.d.ts +1 -1
  53. package/dist/types/core/variables.d.ts +38 -12
  54. package/dist/types/index.d.ts +1 -1
  55. package/dist/types/internal.d.ts +22 -0
  56. package/dist/types/server/index.d.ts +1 -2
  57. package/docs/app-authoring.md +12 -4
  58. package/docs/client.md +5 -6
  59. package/docs/composition.md +84 -0
  60. package/docs/contract.md +41 -21
  61. package/docs/data-context.md +5 -3
  62. package/docs/embed.md +4 -4
  63. package/docs/formatting-and-appearance.md +1 -1
  64. package/docs/hosted-apps.md +4 -0
  65. package/docs/react-embed.md +7 -6
  66. package/docs/react.md +5 -5
  67. package/docs/server-bun.md +5 -5
  68. package/docs/server.md +1 -1
  69. package/docs/stories-and-export.md +3 -3
  70. package/docs/styling.md +6 -2
  71. package/docs/ui.md +18 -7
  72. package/docs/variables.md +83 -11
  73. package/docs/views.md +57 -3
  74. package/docs/widgets.md +97 -4
  75. package/docs/worker.md +4 -4
  76. package/examples/starter-data-app/index.tsx +11 -23
  77. package/examples/starter-local-data-app/AGENTS.md +1 -1
  78. package/examples/starter-local-data-app/README.md +12 -10
  79. package/examples/starter-local-data-app/app.ts +7 -1
  80. package/examples/starter-local-data-app/package.json +3 -1
  81. package/examples/starter-local-data-app/src/App.tsx +1 -1
  82. package/examples/starter-local-data-app/src/data-context.ts +1 -1
  83. package/examples/starter-local-data-app/src/main.tsx +1 -1
  84. package/examples/starter-local-data-app/src/server.ts +1 -1
  85. package/examples/starter-local-data-app/tsconfig.json +7 -1
  86. package/package.json +16 -92
  87. package/THIRD_PARTY_NOTICES +0 -18
  88. package/dist/chunks/index-2sbp9h2b.js.map +0 -13
  89. package/dist/chunks/index-ap60vggk.js +0 -80
  90. package/dist/chunks/index-ap60vggk.js.map +0 -10
  91. package/dist/chunks/index-cv36cyna.js +0 -180
  92. package/dist/chunks/index-cv36cyna.js.map +0 -10
  93. package/dist/chunks/index-k766wwwr.js +0 -643
  94. package/dist/chunks/index-k766wwwr.js.map +0 -13
  95. package/dist/chunks/index-kwnqycjt.js.map +0 -10
  96. package/dist/chunks/index-m0gbxtgp.js +0 -355
  97. package/dist/chunks/index-m0gbxtgp.js.map +0 -13
  98. package/dist/chunks/index-qhzdzca2.js +0 -15869
  99. package/dist/chunks/index-qhzdzca2.js.map +0 -118
  100. package/dist/chunks/index-r7b1ftwy.js.map +0 -10
  101. package/dist/chunks/index-sx488hvs.js +0 -221
  102. package/dist/chunks/index-sx488hvs.js.map +0 -12
  103. package/dist/chunks/index-wss3gd3h.js +0 -319
  104. package/dist/chunks/index-wss3gd3h.js.map +0 -13
  105. package/dist/chunks/index-zcqxfwdq.js +0 -197
  106. package/dist/chunks/index-zcqxfwdq.js.map +0 -13
  107. package/dist/embed/index.js +0 -138
  108. package/dist/embed/index.js.map +0 -12
  109. package/dist/local.js +0 -432
  110. package/dist/local.js.map +0 -14
  111. package/dist/preview.js +0 -1456
  112. package/dist/preview.js.map +0 -17
  113. package/dist/react/embed/index.js +0 -117
  114. package/dist/react/embed/index.js.map +0 -10
  115. package/dist/react/index.js +0 -2948
  116. package/dist/react/index.js.map +0 -26
  117. package/dist/react/ui/index.js +0 -3142
  118. package/dist/react/ui/index.js.map +0 -35
  119. package/dist/server.js +0 -301
  120. package/dist/server.js.map +0 -13
  121. package/dist/types/core/time-interval.d.ts +0 -96
  122. package/dist/types/embed/bootstrap.d.ts +0 -5
  123. package/dist/types/embed/bridge.d.ts +0 -12
  124. package/dist/types/embed/host.d.ts +0 -36
  125. package/dist/types/embed/index.d.ts +0 -14
  126. package/dist/types/embed/navigation.d.ts +0 -6
  127. package/dist/types/embed/runtime-html.d.ts +0 -2
  128. package/dist/types/embed/source.d.ts +0 -16
  129. package/dist/types/embed/sql.d.ts +0 -4
  130. package/dist/types/react/annotations/AnnotationBar.d.ts +0 -30
  131. package/dist/types/react/annotations/AnnotationControls.d.ts +0 -10
  132. package/dist/types/react/annotations/AnnotationEditor.d.ts +0 -16
  133. package/dist/types/react/annotations/AnnotationMarkers.d.ts +0 -19
  134. package/dist/types/react/annotations/AnnotationSelectionLayer.d.ts +0 -12
  135. package/dist/types/react/annotations/AnnotationTarget.d.ts +0 -9
  136. package/dist/types/react/annotations/AnnotationTooltip.d.ts +0 -9
  137. package/dist/types/react/annotations/AnnotationTrigger.d.ts +0 -10
  138. package/dist/types/react/annotations/annotation-editor-state.d.ts +0 -58
  139. package/dist/types/react/annotations/annotation-screenshot.d.ts +0 -4
  140. package/dist/types/react/annotations/annotation-targets.d.ts +0 -34
  141. package/dist/types/react/annotations/getAnnotationProps.d.ts +0 -17
  142. package/dist/types/react/annotations/styles.d.ts +0 -3
  143. package/dist/types/react/annotations/useAnnotationGeometry.d.ts +0 -22
  144. package/dist/types/react/annotations/useDataAppAnnotations.d.ts +0 -22
  145. package/dist/types/react/app-context.d.ts +0 -3
  146. package/dist/types/react/bindings.d.ts +0 -133
  147. package/dist/types/react/content.d.ts +0 -36
  148. package/dist/types/react/date-formatting.d.ts +0 -12
  149. package/dist/types/react/embed/bridge.d.ts +0 -21
  150. package/dist/types/react/embed/index.d.ts +0 -7
  151. package/dist/types/react/hooks.d.ts +0 -75
  152. package/dist/types/react/index.d.ts +0 -75
  153. package/dist/types/react/injectStyles.d.ts +0 -7
  154. package/dist/types/react/mount.d.ts +0 -13
  155. package/dist/types/react/search-suggestions.d.ts +0 -8
  156. package/dist/types/react/source-owner.d.ts +0 -2
  157. package/dist/types/react/style-contract.d.ts +0 -88
  158. package/dist/types/react/style-validation.d.ts +0 -2
  159. package/dist/types/react/styles.d.ts +0 -8
  160. package/dist/types/react/ui/AboutData.d.ts +0 -68
  161. package/dist/types/react/ui/AltertableLogo.d.ts +0 -3
  162. package/dist/types/react/ui/AppFooter.d.ts +0 -6
  163. package/dist/types/react/ui/AppHeader.d.ts +0 -10
  164. package/dist/types/react/ui/AppLayout.d.ts +0 -10
  165. package/dist/types/react/ui/AppScope.d.ts +0 -7
  166. package/dist/types/react/ui/AppToolbar.d.ts +0 -30
  167. package/dist/types/react/ui/AreaChart.d.ts +0 -7
  168. package/dist/types/react/ui/BarChart.d.ts +0 -6
  169. package/dist/types/react/ui/Breakdown.d.ts +0 -13
  170. package/dist/types/react/ui/Button.d.ts +0 -11
  171. package/dist/types/react/ui/ChartLegend.d.ts +0 -32
  172. package/dist/types/react/ui/Checkbox.d.ts +0 -21
  173. package/dist/types/react/ui/CheckboxGroup.d.ts +0 -7
  174. package/dist/types/react/ui/ChoicePicker.d.ts +0 -39
  175. package/dist/types/react/ui/Comparison.d.ts +0 -14
  176. package/dist/types/react/ui/ComposedChart.d.ts +0 -41
  177. package/dist/types/react/ui/ComposedChartLegend.d.ts +0 -8
  178. package/dist/types/react/ui/ContentSkeleton.d.ts +0 -7
  179. package/dist/types/react/ui/DataApp.d.ts +0 -21
  180. package/dist/types/react/ui/DataAppFrame.d.ts +0 -52
  181. package/dist/types/react/ui/DataBoundary.d.ts +0 -14
  182. package/dist/types/react/ui/DataSection.d.ts +0 -14
  183. package/dist/types/react/ui/DataSectionBoundary.d.ts +0 -30
  184. package/dist/types/react/ui/DataTable.d.ts +0 -29
  185. package/dist/types/react/ui/DataValue.d.ts +0 -9
  186. package/dist/types/react/ui/DataViewToast.d.ts +0 -11
  187. package/dist/types/react/ui/DataWidget.d.ts +0 -34
  188. package/dist/types/react/ui/DateDisplay.d.ts +0 -9
  189. package/dist/types/react/ui/DateRangePicker.d.ts +0 -30
  190. package/dist/types/react/ui/DateTimeTooltip.d.ts +0 -10
  191. package/dist/types/react/ui/DimensionPicker.d.ts +0 -13
  192. package/dist/types/react/ui/EmptyState.d.ts +0 -6
  193. package/dist/types/react/ui/ExportControl.d.ts +0 -4
  194. package/dist/types/react/ui/FilterActions.d.ts +0 -10
  195. package/dist/types/react/ui/FilterBar.d.ts +0 -3
  196. package/dist/types/react/ui/FunnelChart.d.ts +0 -20
  197. package/dist/types/react/ui/GettingStarted.d.ts +0 -6
  198. package/dist/types/react/ui/GlossaryDefinition.d.ts +0 -7
  199. package/dist/types/react/ui/GlossaryExplanation.d.ts +0 -16
  200. package/dist/types/react/ui/GradientScroll.d.ts +0 -23
  201. package/dist/types/react/ui/Grid.d.ts +0 -12
  202. package/dist/types/react/ui/GridItem.d.ts +0 -7
  203. package/dist/types/react/ui/HelpPopover.d.ts +0 -21
  204. package/dist/types/react/ui/IconButton.d.ts +0 -19
  205. package/dist/types/react/ui/InspectionContext.d.ts +0 -12
  206. package/dist/types/react/ui/InspectionProvider.d.ts +0 -29
  207. package/dist/types/react/ui/JourneyChart.d.ts +0 -10
  208. package/dist/types/react/ui/Kbd.d.ts +0 -7
  209. package/dist/types/react/ui/LineChart.d.ts +0 -7
  210. package/dist/types/react/ui/LiveControl.d.ts +0 -10
  211. package/dist/types/react/ui/Menu.d.ts +0 -12
  212. package/dist/types/react/ui/MetricWidget.d.ts +0 -49
  213. package/dist/types/react/ui/NumberField.d.ts +0 -27
  214. package/dist/types/react/ui/NumberFilterPicker.d.ts +0 -11
  215. package/dist/types/react/ui/PeriodSummary.d.ts +0 -17
  216. package/dist/types/react/ui/PickerField.d.ts +0 -15
  217. package/dist/types/react/ui/PieChart.d.ts +0 -11
  218. package/dist/types/react/ui/PopoverSurface.d.ts +0 -5
  219. package/dist/types/react/ui/PresentStory.d.ts +0 -30
  220. package/dist/types/react/ui/QueryList.d.ts +0 -14
  221. package/dist/types/react/ui/RadioGroup.d.ts +0 -18
  222. package/dist/types/react/ui/Ranking.d.ts +0 -13
  223. package/dist/types/react/ui/RefreshControl.d.ts +0 -9
  224. package/dist/types/react/ui/RequestHint.d.ts +0 -20
  225. package/dist/types/react/ui/RetentionChart.d.ts +0 -27
  226. package/dist/types/react/ui/ScatterChart.d.ts +0 -17
  227. package/dist/types/react/ui/SearchField.d.ts +0 -23
  228. package/dist/types/react/ui/SearchInput.d.ts +0 -10
  229. package/dist/types/react/ui/SearchMatch.d.ts +0 -6
  230. package/dist/types/react/ui/SearchTypeahead.d.ts +0 -15
  231. package/dist/types/react/ui/SectionHeading.d.ts +0 -8
  232. package/dist/types/react/ui/Select.d.ts +0 -18
  233. package/dist/types/react/ui/SelectionMark.d.ts +0 -5
  234. package/dist/types/react/ui/Sheet.d.ts +0 -21
  235. package/dist/types/react/ui/Skeleton.d.ts +0 -8
  236. package/dist/types/react/ui/Stack.d.ts +0 -7
  237. package/dist/types/react/ui/StaticDataApp.d.ts +0 -4
  238. package/dist/types/react/ui/StatusPanel.d.ts +0 -10
  239. package/dist/types/react/ui/TableWidget.d.ts +0 -67
  240. package/dist/types/react/ui/Tabs.d.ts +0 -10
  241. package/dist/types/react/ui/TextContent.d.ts +0 -4
  242. package/dist/types/react/ui/TextWidget.d.ts +0 -20
  243. package/dist/types/react/ui/ThemeSelector.d.ts +0 -12
  244. package/dist/types/react/ui/Toast.d.ts +0 -8
  245. package/dist/types/react/ui/Tooltip.d.ts +0 -23
  246. package/dist/types/react/ui/TooltipSurface.d.ts +0 -3
  247. package/dist/types/react/ui/TrendChart.d.ts +0 -5
  248. package/dist/types/react/ui/UpdatedAt.d.ts +0 -9
  249. package/dist/types/react/ui/VariableBar.d.ts +0 -6
  250. package/dist/types/react/ui/VisualizationWidget.d.ts +0 -43
  251. package/dist/types/react/ui/WidgetDisclosure.d.ts +0 -6
  252. package/dist/types/react/ui/WidgetEvidence.d.ts +0 -12
  253. package/dist/types/react/ui/WidgetViewTabs.d.ts +0 -16
  254. package/dist/types/react/ui/chart-data.d.ts +0 -34
  255. package/dist/types/react/ui/chart-date-axis.d.ts +0 -15
  256. package/dist/types/react/ui/chart-interaction.d.ts +0 -21
  257. package/dist/types/react/ui/chart-primitives.d.ts +0 -22
  258. package/dist/types/react/ui/chart-time.d.ts +0 -16
  259. package/dist/types/react/ui/chartColor.d.ts +0 -2
  260. package/dist/types/react/ui/classNames.d.ts +0 -1
  261. package/dist/types/react/ui/csv-export.d.ts +0 -19
  262. package/dist/types/react/ui/data-context.d.ts +0 -76
  263. package/dist/types/react/ui/data-identifiers.d.ts +0 -32
  264. package/dist/types/react/ui/icons.d.ts +0 -47
  265. package/dist/types/react/ui/index.d.ts +0 -109
  266. package/dist/types/react/ui/journey-flow.d.ts +0 -49
  267. package/dist/types/react/ui/keyboard.d.ts +0 -6
  268. package/dist/types/react/ui/metric-comparison.d.ts +0 -30
  269. package/dist/types/react/ui/metric.d.ts +0 -11
  270. package/dist/types/react/ui/presentation.d.ts +0 -25
  271. package/dist/types/react/ui/search.d.ts +0 -6
  272. package/dist/types/react/ui/searchItems.d.ts +0 -36
  273. package/dist/types/react/ui/shortcuts.d.ts +0 -45
  274. package/dist/types/react/ui/story.d.ts +0 -20
  275. package/dist/types/react/ui/useAppAppearance.d.ts +0 -3
  276. package/dist/types/react/ui/useDataAppPresentation.d.ts +0 -3
  277. package/dist/types/react/ui/useSvgId.d.ts +0 -2
  278. package/dist/types/react/ui/variables.d.ts +0 -38
  279. package/dist/types/react/ui/widget-views.d.ts +0 -3
  280. package/dist/types/react/view-control-bar.d.ts +0 -16
  281. package/dist/types/react/view-controls.d.ts +0 -20
  282. package/dist/types/react/view-runtime.d.ts +0 -31
  283. package/dist/types/react/view.d.ts +0 -78
  284. package/dist/types/react/widgets.d.ts +0 -79
  285. package/dist/types/server/local.d.ts +0 -19
  286. package/dist/types/server/preview/host.d.ts +0 -1
  287. package/dist/types/server/preview/index.d.ts +0 -16
  288. package/dist/types/server/reload-channel.d.ts +0 -6
  289. package/dist/worker.js +0 -106
package/AGENTS.md CHANGED
@@ -9,6 +9,11 @@ both derived from the displayed result. Setup and static screens may omit them.
9
9
  Follow [app authoring](docs/app-authoring.md) for the shared workflow, the data app
10
10
  and local data app paths, and task-specific documentation.
11
11
 
12
+ Look up exports in the generated [API reference](REFERENCE.md), which ships in
13
+ the package. It has one line per export and per prop, with types, `?` for
14
+ optional, and a JSDoc summary. `rg '^LineChart\b' REFERENCE.md` returns a
15
+ component and its props.
16
+
12
17
  ## Styling
13
18
 
14
19
  Use components and typed props first; customize through app-owned `className`
@@ -36,18 +41,23 @@ Read the matching guide before generating an app. Package contributors follow
36
41
  | Task | Read |
37
42
  | -------------------------------------- | -------------------------------------------------------------- |
38
43
  | Choose hosted or local execution | [App authoring](docs/app-authoring.md) |
44
+ | Plan a coherent exploration and story | [Composition](docs/composition.md) |
39
45
  | Load data and compose loading states | [Views](docs/views.md) |
40
46
  | Add filters | [Variables](docs/variables.md) |
41
47
  | Compose visuals, tables, and narrative | [Widgets](docs/widgets.md), [layout](docs/layout.md) |
42
48
  | Define sources and evidence | [Data context](docs/data-context.md) |
43
49
  | Present findings and export results | [Stories and export](docs/stories-and-export.md) |
44
50
  | Format values and appearance | [Formatting and appearance](docs/formatting-and-appearance.md) |
51
+ | Look up props, signatures, and types | [API reference](REFERENCE.md) |
45
52
 
46
- Use `/react` with declared views and bound widgets. `/react/ui` is for setup,
53
+ Use `@altertable/data-app-react` with declared views and bound widgets. `@altertable/data-app-react/ui` is for setup,
47
54
  static displays, and deliberately custom UI; see [direct composition](docs/ui.md).
48
55
  Prefer derivation over repeated configuration. Keep static context outside loading boundaries. Derive labels, findings, and
49
56
  exports from the displayed result and its input. Edit app-owned files; installed
50
57
  package files are dependencies.
58
+ Declare typed `params` and `projections`; derive operation data from `query()` rows
59
+ without duplicate schemas or type assertions. See [contracts](docs/contract.md)
60
+ and [facets](docs/variables.md#fixed-options-and-query-backed-facets).
51
61
 
52
62
  Keep `docs/` focused on knowledge agents need to build data apps. Put package
53
63
  implementation, testing, and release guidance in `CONTRIBUTING.md`.
package/CONTRIBUTING.md CHANGED
@@ -12,11 +12,11 @@ bun run check
12
12
 
13
13
  | Task | Location |
14
14
  | --------------------------------------- | -------------------------------------------------------------- |
15
- | Operations, validation, and data state | `src/core` |
16
- | Browser clients and navigation | `src/client` |
17
- | Request authorization and local serving | `src/server` |
18
- | Iframe hosting and bootstrap | `src/embed`, `src/worker` |
19
- | React bindings and UI | `src/react` |
15
+ | Operations, validation, and data state | `packages/data-app/src/core` |
16
+ | Browser clients and navigation | `packages/data-app/src/client` |
17
+ | Request authorization and local serving | `packages/data-app/src/server`, `packages/data-app-bun/src` |
18
+ | Iframe hosting and bootstrap | `packages/data-app-embed`, `packages/data-app-worker` |
19
+ | React bindings and UI | `packages/data-app-react/src` |
20
20
  | Consumer examples | `examples/starter-local-data-app`, `examples/starter-data-app` |
21
21
  | Public guides | `docs` |
22
22
  | Build, package checks, and releases | `scripts` |
@@ -25,21 +25,44 @@ Keep browser entries free of server implementations and credentials. Core,
25
25
  client, server, and embed remain independent of React. Implementations import
26
26
  focused modules; public entry points declare the supported exports explicitly.
27
27
  Keep style injection explicit; importing React must not modify the DOM. Add new
28
- styles to `src/react/styles.css`. Do not edit generated `dist`.
29
-
30
- Use `@/src/...` imports in repository source and `@altertable/data-app/<entry>`
31
- in consumer tests and examples. Run `bun run lint:fix` and `bun run format` for
28
+ styles to `packages/data-app-react/src/styles.css`. Do not edit generated `dist`.
29
+
30
+ Use relative imports within each package and declared package exports across
31
+ packages. Relative source imports include their `.ts` or `.tsx` extension; builds
32
+ emit JavaScript and normalize declaration imports to `.js`. Consumers import
33
+ package names and exported subpaths. Use repository-root `@/` imports for
34
+ contributor tooling and fixtures.
35
+ Consumer tests and examples import the published package names. The base
36
+ `/internal` entry is shared implementation for coordinated packages; app authors
37
+ use documented entries. Run `bun run lint:fix` and `bun run format` for
32
38
  style fixes.
33
39
 
34
40
  Compose the gallery from provided components, including layouts. Let primitives
35
41
  own sizing, spacing, and responsive behavior. Report missing primitives and keep
36
42
  fallbacks minimal.
37
43
 
44
+ ## Workspace packages
45
+
46
+ The root is private. Publishable packages live in `packages/`; examples remain
47
+ private workspaces. `scripts/packages.ts` lists packages in dependency order.
48
+ Run `bun run build` from the root to build JavaScript, declarations, explicit
49
+ styles, the embed bootstrap, the bundled preview host, and the standalone Worker.
50
+ Package-level builds require their dependencies to have been built first.
51
+
52
+ Every package declares its own runtime dependencies and peers. Cross-package
53
+ builds externalize dependencies to preserve shared module identity. The Worker,
54
+ bootstrap, and preview host are deliberately self-contained build artifacts.
55
+
56
+ `bun run check:boundaries` verifies ownership and release version consistency.
57
+ `bun run check:package` packs every package and installs consumer combinations
58
+ outside the checkout to verify dependency isolation, portable types, browser
59
+ bundling, and Bun previews without workspace hoisting.
60
+
38
61
  ## Verify changes
39
62
 
40
63
  Write high-level public API tests with Vitest in `tests/public-api`. Define an
41
64
  operation, authorize and query it, compose a view, or embed an app through
42
- `@altertable/data-app/<entry>`. Assert consumer-visible results and errors. Supply
65
+ the published package exports. Assert consumer-visible results and errors. Supply
43
66
  data and failures through public dependency injection; do not import private
44
67
  source, fabricate internal state, or assert implementation details. Prefer queries by role and accessible name, or by label for form fields. Scope
45
68
  content assertions to the relevant region, status, alert, or dialog; use text
@@ -63,20 +86,30 @@ and [hosted authoring](docs/hosted-apps.md).
63
86
  `bun run check` builds first and runs all required source, Markdown, local link, package, and starter
64
87
  checks. Build before running consumer tests individually.
65
88
 
66
- | Command | Purpose |
67
- | ------------------------------ | --------------------------------------------------- |
68
- | `bun run build` | Build JavaScript, declarations, and injected styles |
69
- | `bun run check:styles` | Validate authored styling hooks |
70
- | `bun run typecheck` | Check source, tests, and scripts |
71
- | `bun run lint` | Run type-aware lint checks |
72
- | `bun run lint:md` | Check Markdown structure and syntax |
73
- | `bun run check:links` | Validate local files, images, and heading links |
74
- | `bun run check:links:external` | Check external URLs (requires network access) |
75
- | `bun run format` | Format source and docs |
76
- | `bun run test` | Verify high-level public API workflows with Vitest |
77
- | `bun run check:package` | Verify the npm archive as a consumer |
78
- | `bun run check:starter` | Typecheck, lint, and build the starter |
79
- | `bun run check:workflows` | Validate workflows and shell scripts |
89
+ | Command | Purpose |
90
+ | ------------------------------ | -------------------------------------------------- |
91
+ | `bun run build` | Build JavaScript, declarations, styles, reference |
92
+ | `bun run check:reference` | Verify the staged `REFERENCE.md` is current |
93
+ | `bun run check:styles` | Validate authored styling hooks |
94
+ | `bun run typecheck` | Check source, tests, and scripts |
95
+ | `bun run lint` | Run type-aware lint checks |
96
+ | `bun run lint:md` | Check Markdown structure and syntax |
97
+ | `bun run check:links` | Validate local files, images, and heading links |
98
+ | `bun run check:links:external` | Check external URLs (requires network access) |
99
+ | `bun run format` | Format source and docs |
100
+ | `bun run test` | Verify high-level public API workflows with Vitest |
101
+ | `bun run check:package` | Verify the npm archive as a consumer |
102
+ | `bun run check:starter` | Typecheck, lint, and build the starter |
103
+ | `bun run check:workflows` | Validate workflows and shell scripts |
104
+
105
+ `scripts/build-reference.ts` generates `REFERENCE.md` from the emitted
106
+ declarations with the TypeScript checker, covering documented workspace package
107
+ entry points. Undocumented implementation entries remain excluded. The base
108
+ package ships a generated copy alongside its guides. Commit the root reference
109
+ when a build changes it. Generation fails when an export or prop type does not
110
+ resolve, and `bun run check:reference` fails when the staged file differs from
111
+ the generated one. Improve entries through JSDoc and types, not by editing the
112
+ file.
80
113
 
81
114
  Markdown checks cover all authored `.md` files, including `AGENTS.md` and the
82
115
  starter docs. Oxfmt owns formatting. Release Please owns `CHANGELOG.md`, so
@@ -90,7 +123,7 @@ rate limits can cause failures unrelated to a change.
90
123
 
91
124
  Run `bun run dev` to preview UI examples at `http://127.0.0.1:27418/gallery`
92
125
  and a playground at `/playground` (`dev/playground.tsx`, querying the demo
93
- tables from `dev/seed.ts` that `scripts/dev.ts` seeds). It builds once, then rebuilds `dist` when `src`
126
+ tables from `dev/seed.ts` that `scripts/dev.ts` seeds). It builds once, then rebuilds `dist` when package source
94
127
  changes; open pages reload on package, fixture, and playground edits. Restart it after changing
95
128
  `dev/server.ts`; rerun `bun run build` to refresh declarations. Add `?delay=2000` to a host page URL
96
129
  to delay its SQL responses and inspect loading states. It needs Docker: SQL runs
@@ -101,7 +134,7 @@ started with Testcontainers and stopped on exit. Public API tests use their own
101
134
  Run `bun run dev:file <path>` to preview a single-file data app such as
102
135
  `examples/starter-data-app/index.tsx` from anywhere on disk, or `bun run dev:dir <path>`
103
136
  for a local data app directory with `src/server.ts`. Both resolve `@altertable/data-app`
104
- and React from this checkout's `dist`, so the app needs no install. Run `bun run build`
137
+ and React from this checkout's package builds, so the app needs no install. Run `bun run build`
105
138
  after package changes. File previews replace the app iframe on edits and preserve
106
139
  URL filters. Directory previews restart the app server when its imports change.
107
140
  Unlike `bun run dev`, neither uses the mocked API: set `ALTERTABLE_USERNAME` and `ALTERTABLE_PASSWORD` (or the
package/README.md CHANGED
@@ -1,41 +1,37 @@
1
- # Altertable Data App
1
+ # @altertable/data-app
2
2
 
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
3
+ Portable definitions, contracts, formatting, browser clients, and request handlers
4
+ for Altertable data apps.
4
5
 
5
- **Build data apps powered by Altertable.**
6
-
7
- A TypeScript and React toolkit with APIs, components, and authoring guides for
8
- developers and AI agents to build data apps powered by Altertable.
9
-
10
- A data app combines interactive exploration with explanations and findings,
11
- helping users answer questions with data. Compose filters, charts, tables, and
12
- narrative, then let users present findings and export results.
13
-
14
- ## Install
6
+ ## Installation
15
7
 
16
8
  ```fish
17
- npm install @altertable/data-app
18
- # or
19
- pnpm add @altertable/data-app
20
- # or
21
9
  bun add @altertable/data-app
22
10
  ```
23
11
 
24
- ## Build an app
12
+ ## Usage
25
13
 
26
- Apps can be embedded in Altertable, ChatGPT, Claude, and other hosts that support
27
- MCP Apps through a host integration, or run locally in a browser.
14
+ Declare an app's identity and query registry:
28
15
 
29
- | App | Guide | Starter |
30
- | --------------- | -------------------------------------- | ---------------------------------------------------------- |
31
- | Remote data app | [Remote guide](docs/hosted-apps.md) | [Single file](examples/starter-data-app/index.tsx) |
32
- | Local data app | [Local guide](docs/local-data-apps.md) | [Local project](examples/starter-local-data-app/README.md) |
16
+ ```ts
17
+ import { defineDataApp } from '@altertable/data-app';
18
+
19
+ const app = defineDataApp({
20
+ title: 'Activity',
21
+ description: 'Explore activity across your organization.',
22
+ scope: { organization: 'demo', environment: 'production' },
23
+ queries: {},
24
+ });
25
+ ```
33
26
 
34
- For agent-assisted work, direct your agent to [AGENTS.md](AGENTS.md).
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.
35
30
 
36
- ## Development
31
+ ## Documentation
37
32
 
38
- See [Contributing](CONTRIBUTING.md) to develop and test the package.
33
+ Start with [app authoring](docs/app-authoring.md). Guides, starters, and
34
+ [agent instructions](AGENTS.md) ship with this package.
39
35
 
40
36
  ## License
41
37