@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
@@ -3,11 +3,13 @@
3
3
  Use this starter with the [local authoring guide](https://github.com/altertable-ai/data-app/blob/main/docs/local-data-apps.md).
4
4
  See [AGENTS.md](AGENTS.md) for app-owned files.
5
5
 
6
- A Bun and React app that imports the public `@altertable/data-app` package.
6
+ A Bun and React starter for Altertable data apps using the published packages.
7
7
  It starts with a lakehouse connectivity check. Replace that check with bounded
8
8
  operations and views built from inspected data before sharing an analysis.
9
9
 
10
- ## Run from this repository
10
+ ## Usage
11
+
12
+ ### Run from this repository
11
13
 
12
14
  Use the Bun and Node versions in `.bun-version` and `.node-version`.
13
15
  From the repository root:
@@ -15,13 +17,10 @@ From the repository root:
15
17
  ```fish
16
18
  bun install --frozen-lockfile
17
19
  bun run build
18
- bun install --frozen-lockfile
19
20
  cd examples/starter-local-data-app
20
21
  bun run dev
21
22
  ```
22
23
 
23
- The second install refreshes the local file dependency with the built exports.
24
-
25
24
  Open <http://127.0.0.1:25837>. Missing credentials show the connection error state;
26
25
  the page still runs. Set server-only credentials before starting the server:
27
26
 
@@ -36,12 +35,11 @@ Alternatively, supply `ALTERTABLE_DATA_PROXY_URL` and
36
35
  `ALTERTABLE_DATA_PROXY_TOKEN` for an existing CLI proxy. These values must stay
37
36
  on the server. This local adapter does not authorize hosted viewers.
38
37
 
39
- ## Make it your app
38
+ ### Make it your app
40
39
 
41
- This checkout uses `file:../..` to exercise the built package before publication.
42
- When copying the starter elsewhere, replace that dependency with the published
43
- package using `bun add @altertable/data-app`, `npm install @altertable/data-app`,
44
- or `pnpm add @altertable/data-app`, then regenerate your lockfile.
40
+ This starter declares the published base, React, and Bun packages. Inside this
41
+ repository, Bun links their workspace builds. When copying the starter elsewhere,
42
+ run `bun install` to install those packages from npm.
45
43
 
46
44
  ```fish
47
45
  bun run check
@@ -52,3 +50,7 @@ and queries.
52
50
 
53
51
  `bun run build` typechecks the app, then bundles the browser page into `dist/`. That browser artifact
54
52
  still needs an authorized `/api/data` backend when hosted.
53
+
54
+ ## License
55
+
56
+ [MIT](../../LICENSE)
@@ -18,5 +18,11 @@ export const dataApp = defineDataApp({
18
18
  heading: "system",
19
19
  },
20
20
  },
21
- queries: { connection: { statement: "SELECT 1 AS connection_check", params: {} } },
21
+ queries: {
22
+ connection: {
23
+ projections: { connection_check: { type: "number" } },
24
+ statement: "SELECT 1 AS connection_check",
25
+ params: {},
26
+ },
27
+ },
22
28
  });
@@ -16,7 +16,9 @@
16
16
  "check": "bun run lint && bun run format:check && bun run build"
17
17
  },
18
18
  "dependencies": {
19
- "@altertable/data-app": "file:../..",
19
+ "@altertable/data-app": "0.71.0",
20
+ "@altertable/data-app-bun": "0.71.0",
21
+ "@altertable/data-app-react": "0.71.0",
20
22
  "react": "19.3.0",
21
23
  "react-dom": "19.3.0"
22
24
  },
@@ -1,4 +1,4 @@
1
- import { GettingStarted } from "@altertable/data-app/react/ui";
1
+ import { GettingStarted } from "@altertable/data-app-react/ui";
2
2
  import { dataContext } from "#app/data-context.ts";
3
3
 
4
4
  /** Connectivity-only screen. Investigate the requested question, then replace this with a view
@@ -1,4 +1,4 @@
1
- import { createDataContext } from "@altertable/data-app/react";
1
+ import { createDataContext } from "@altertable/data-app-react";
2
2
  import { dataApp } from "#config";
3
3
 
4
4
  const connectionQueryNames = { connection: "connection" } satisfies Record<
@@ -1,4 +1,4 @@
1
- import { injectDataAppStyles, mountDataApp } from "@altertable/data-app/react";
1
+ import { injectDataAppStyles, mountDataApp } from "@altertable/data-app-react";
2
2
  import { App } from "#app/App.tsx";
3
3
  import { dataApp as app } from "#config";
4
4
 
@@ -1,5 +1,5 @@
1
1
  import page from "#app/index.html";
2
- import { serveLocalApp } from "@altertable/data-app/server/bun";
2
+ import { serveLocalApp } from "@altertable/data-app-bun";
3
3
  import { operations } from "#app/operations.ts";
4
4
  import { dataApp as app } from "#config";
5
5
 
@@ -7,9 +7,15 @@
7
7
  "resolveJsonModule": true,
8
8
  "jsx": "react-jsx",
9
9
  "strict": true,
10
+ "noUncheckedIndexedAccess": true,
10
11
  "noEmit": true,
11
12
  "skipLibCheck": true,
12
- "types": ["bun"]
13
+ "types": ["bun"],
14
+ "noImplicitReturns": true,
15
+ "noFallthroughCasesInSwitch": true,
16
+ "noImplicitOverride": true,
17
+ "allowUnreachableCode": false,
18
+ "noUncheckedSideEffectImports": true
13
19
  },
14
20
  "include": ["src", "app.ts"]
15
21
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@altertable/data-app",
3
- "version": "0.69.0",
4
- "description": "A TypeScript and React toolkit with APIs, components, and authoring guides for developers and AI agents to build data apps powered by Altertable.",
3
+ "version": "0.71.0",
4
+ "description": "Portable definitions, contracts, formatting, browser clients, and request handlers for Altertable data apps.",
5
5
  "keywords": [
6
6
  "altertable",
7
7
  "analytics",
@@ -20,20 +20,18 @@
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "git+https://github.com/altertable-ai/data-app.git"
23
+ "url": "git+https://github.com/altertable-ai/data-app.git",
24
+ "directory": "packages/data-app"
24
25
  },
25
- "workspaces": [
26
- "examples/starter-local-data-app"
27
- ],
28
26
  "files": [
29
27
  "dist",
30
- "docs",
31
- "examples/starter-data-app",
32
- "examples/starter-local-data-app",
33
28
  "README.md",
34
- "CONTRIBUTING.md",
29
+ "LICENSE",
30
+ "docs",
31
+ "examples",
35
32
  "AGENTS.md",
36
- "THIRD_PARTY_NOTICES"
33
+ "CONTRIBUTING.md",
34
+ "REFERENCE.md"
37
35
  ],
38
36
  "type": "module",
39
37
  "sideEffects": false,
@@ -64,34 +62,11 @@
64
62
  },
65
63
  "./server": {
66
64
  "types": "./dist/types/server/index.d.ts",
67
- "import": "./dist/server.js"
68
- },
69
- "./server/bun": {
70
- "types": "./dist/types/server/local.d.ts",
71
- "import": "./dist/local.js"
72
- },
73
- "./server/bun/preview": {
74
- "types": "./dist/types/server/preview/index.d.ts",
75
- "import": "./dist/preview.js"
65
+ "import": "./dist/server/index.js"
76
66
  },
77
- "./react": {
78
- "types": "./dist/types/react/index.d.ts",
79
- "import": "./dist/react/index.js"
80
- },
81
- "./embed": {
82
- "types": "./dist/types/embed/index.d.ts",
83
- "import": "./dist/embed/index.js"
84
- },
85
- "./worker": {
86
- "default": "./dist/worker.js"
87
- },
88
- "./react/embed": {
89
- "types": "./dist/types/react/embed/index.d.ts",
90
- "import": "./dist/react/embed/index.js"
91
- },
92
- "./react/ui": {
93
- "types": "./dist/types/react/ui/index.d.ts",
94
- "import": "./dist/react/ui/index.js"
67
+ "./internal": {
68
+ "types": "./dist/types/internal.d.ts",
69
+ "import": "./dist/internal.js"
95
70
  }
96
71
  },
97
72
  "publishConfig": {
@@ -99,60 +74,9 @@
99
74
  "registry": "https://registry.npmjs.org"
100
75
  },
101
76
  "scripts": {
102
- "build": "bun run scripts/build.ts && tsc -p tsconfig.build.json && bun run scripts/build-declarations.ts",
103
- "dev": "bun run scripts/dev.ts",
104
- "dev:file": "bun run scripts/dev-file.ts",
105
- "dev:dir": "bun run scripts/dev-dir.ts",
106
- "typecheck": "bun install --frozen-lockfile && tsc --noEmit",
107
- "lint": "oxlint --type-aware src tests scripts dev examples/starter-data-app vitest.config.ts",
108
- "format": "oxfmt .",
109
- "format:check": "oxfmt --check .",
110
- "test": "vitest run",
111
- "check": "bun run build && bun run typecheck && bun run lint && bun run check:styles && bun run lint:md && bun run check:links && bun run format:check && bun run test && bun run check:package && bun run check:starter",
112
- "check:package": "bun run scripts/check-package.ts",
113
- "check:workflows": "bash scripts/check-workflows.sh",
114
- "lint:fix": "oxlint --type-aware --fix src tests scripts dev vitest.config.ts",
115
- "check:starter": "bun run scripts/check-starter.ts",
116
- "lint:md": "markdownlint-cli2",
117
- "check:links": "remark . --ext md --rc-path .remarkrc.json --frail --no-stdout",
118
- "check:links:external": "remark . --ext md --rc-path .remarkrc-external.json --frail --no-stdout",
119
- "check:styles": "bun run scripts/check-app-styles.ts"
77
+ "build": "bun ../../scripts/build.ts data-app"
120
78
  },
121
79
  "dependencies": {
122
- "@altertable/lakehouse": "0.4.1",
123
- "@floating-ui/react": "0.27.20",
124
- "@internationalized/date": "3.12.4",
125
- "@tanstack/react-query": "5.104.0",
126
- "fflate": "0.8.3",
127
- "fuzzysort": "4.0.2",
128
- "html-to-image": "1.11.13",
129
- "lucide-react": "1.48.0",
130
- "react-aria-components": "1.21.1",
131
- "recharts": "3.10.1"
132
- },
133
- "devDependencies": {
134
- "@types/bun": "1.4.2",
135
- "@types/react": "19.3.0",
136
- "@types/react-dom": "19.3.0",
137
- "get-tsconfig": "4.14.3",
138
- "markdownlint-cli2": "0.23.3",
139
- "oxfmt": "0.70.0",
140
- "oxlint": "1.85.0",
141
- "oxlint-tsgolint": "7.0.2003",
142
- "playwright": "1.63.0",
143
- "react": "19.3.0",
144
- "react-dom": "19.3.0",
145
- "remark-cli": "12.0.1",
146
- "remark-gfm": "4.0.1",
147
- "remark-lint-no-dead-urls": "2.0.1",
148
- "remark-validate-links": "13.1.0",
149
- "testcontainers": "12.2.0",
150
- "typescript": "7.0.2",
151
- "vitest": "4.1.11"
152
- },
153
- "peerDependencies": {
154
- "react": ">=19.2.0",
155
- "react-dom": ">=19.2.0"
156
- },
157
- "packageManager": "bun@1.4.2"
80
+ "@internationalized/date": "3.12.4"
81
+ }
158
82
  }
@@ -1,18 +0,0 @@
1
- d3-time 3.1.0 and d3-array 3.2.4
2
- https://github.com/d3/d3-time
3
- https://github.com/d3/d3-array
4
-
5
- Copyright 2010-2022 Mike Bostock (d3-time)
6
- Copyright 2010-2023 Mike Bostock (d3-array tick-step helpers)
7
-
8
- Permission to use, copy, modify, and/or distribute this software for any purpose
9
- with or without fee is hereby granted, provided that the above copyright notice
10
- and this permission notice appear in all copies.
11
-
12
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
14
- FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
16
- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
17
- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
18
- THIS SOFTWARE.
@@ -1,13 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/client/transport.ts", "../src/client/messages.ts", "../src/client/logger.ts", "../src/client/iframe.ts"],
4
- "sourcesContent": [
5
- "import type { TransportResponse } from '@/src/core/bridge';\n\nexport type DataTransport = (\n operation: string,\n input: unknown,\n signal?: AbortSignal\n) => Promise<TransportResponse>;\n\n// A bootstrap and its app may bundle independent copies in the same window.\nconst errorBrand = Symbol.for('@altertable/data-app/DataAppError');\n\nexport class DataAppError extends Error {\n readonly [errorBrand] = true;\n\n static [Symbol.hasInstance](value: unknown): boolean {\n return (\n value instanceof Error &&\n (value as { [errorBrand]?: unknown })[errorBrand] === true\n );\n }\n\n constructor(\n message: string,\n public readonly code: string,\n public readonly requestId?: string\n ) {\n super(message);\n this.name = 'DataAppError';\n }\n}\n\nexport function createHttpTransport({\n endpoint = '/api/data',\n fetch: request = globalThis.fetch,\n}: {\n endpoint?: string;\n fetch?: typeof fetch;\n} = {}): DataTransport {\n async function requestData(\n operation: string,\n input: unknown,\n signal?: AbortSignal\n ): Promise<TransportResponse> {\n const response = await request(\n `${endpoint.replace(/\\/$/, '')}/${encodeURIComponent(operation)}`,\n {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(input),\n signal,\n }\n );\n try {\n return { status: response.status, body: await response.json() };\n } catch (error) {\n if (signal?.aborted) throw error;\n throw new DataAppError(\n response.ok ? 'The data response was invalid.' : 'Could not load data.',\n response.ok ? 'invalid_response' : 'request_failed'\n );\n }\n }\n\n return requestData;\n}\n",
6
- "import {\n MessageRoutingError,\n type MessageInput,\n type MessageOutput,\n type MessageRoutes,\n type MessageTransport,\n} from '@/src/core/messages';\n\n/** Both ends validate using the same contracts; the transport owns delivery and cancellation. */\nexport function createMessageClient<const Routes extends MessageRoutes>(\n routes: Routes,\n transport: MessageTransport\n) {\n return {\n async request<\n Name extends keyof Routes & string,\n const Input extends MessageInput<NoInfer<Routes[Name]>>,\n >(\n route: Name,\n payload: Input,\n { signal }: { signal?: AbortSignal } = {}\n ): Promise<MessageOutput<Routes[Name], Input>> {\n signal?.throwIfAborted();\n if (!Object.hasOwn(routes, route))\n throw new MessageRoutingError(\n 'unknown_route',\n 'Unknown message route.'\n );\n const contract = routes[route]!;\n let input: unknown;\n try {\n input = contract.input(payload);\n } catch {\n throw new MessageRoutingError(\n 'invalid_payload',\n 'Invalid message payload.'\n );\n }\n const response = await transport({ route, payload: input }, signal);\n signal?.throwIfAborted();\n try {\n return contract.output(response, input as never) as MessageOutput<\n Routes[Name],\n Input\n >;\n } catch (error) {\n if (error instanceof MessageRoutingError) throw error;\n throw new MessageRoutingError(\n 'invalid_response',\n 'Invalid message response.'\n );\n }\n },\n };\n}\n",
7
- "import type { BridgeDiagnostic } from '@/src/core/bridge';\nimport { type DataAppLogger, type LogEntry } from '@/src/core/logger';\n\n/** Lazy arguments run in the iframe; only resolved values cross the bridge. */\nexport function createBridgeLogger(\n enabled: () => boolean,\n send: (entry: LogEntry) => void\n): DataAppLogger {\n function resolve(args: unknown[]): unknown[] {\n if (args.length === 1 && typeof args[0] === 'function') {\n const value: unknown = args[0]();\n return Array.isArray(value) ? value : [value];\n }\n return args.map(arg => (typeof arg === 'function' ? arg() : arg));\n }\n\n function write(method: keyof DataAppLogger, args: unknown[]) {\n if (!enabled()) return;\n try {\n send({ method, args: resolve(args) });\n } catch {\n // Logging must not interrupt the app or recursively log delivery failures.\n }\n }\n\n return {\n log: (...args) => write('log', args),\n info: (...args) => write('info', args),\n warn: (...args) => write('warn', args),\n error: (...args) => write('error', args),\n };\n}\n\nconst diagnosticLabels = {\n send: 'Sending message to parent',\n receive: 'Received message from parent',\n drop: 'Ignored message from parent',\n} as const;\n\n/** Log only delivery metadata; payloads and session credentials stay private. */\nexport function logBridgeDiagnostic(\n logger: DataAppLogger,\n { direction, ...metadata }: BridgeDiagnostic\n) {\n if (metadata.type === 'runtime:log') return;\n logger.log(diagnosticLabels[direction], metadata);\n}\n\n/** Error instances do not survive every logger, so only their text crosses the bridge. */\nexport function describeError(error: unknown) {\n if (error instanceof Error)\n return {\n name: error.name,\n message: error.message,\n ...(error.stack ? { stack: error.stack } : {}),\n };\n return { message: String(error) };\n}\n",
8
- "import { randomUuid } from '@/src/core/uuid';\nimport { createBridgeEndpoint } from '@/src/core/bridge-endpoint';\nimport {\n PARENT_PARAM,\n MAX_PENDING,\n REQUEST_TIMEOUT_MS,\n type TransportResponse,\n} from '@/src/core/bridge';\nimport {\n defineDataQueryRoute,\n sqlQueryRoute,\n MessageRoutingError,\n type RoutedMessage,\n} from '@/src/core/messages';\nimport type { Lakehouse } from '@/src/core/contract';\nimport { createMessageClient } from '@/src/client/messages';\nimport { DataAppError } from '@/src/client/transport';\nimport {\n createBridgeLogger,\n describeError,\n logBridgeDiagnostic,\n} from '@/src/client/logger';\n\ntype Pending = {\n start: () => void;\n reject: (error: unknown) => void;\n resolve: (value: unknown) => void;\n};\n\n/** Data clients expose one error type for HTTP and message delivery. */\nfunction rethrowDataMessageError(error: unknown): never {\n if (error instanceof MessageRoutingError)\n throw new DataAppError(error.message, error.code, error.requestId);\n throw error;\n}\n\n/** One bridge per document, shared by all clients and retained across module hot replacement. */\nexport function createIframeTransport({\n parentOrigin,\n window: frame = window,\n timeoutMs = REQUEST_TIMEOUT_MS,\n mode = 'url',\n loadScript,\n}: {\n parentOrigin: string;\n window?: Window;\n timeoutMs?: number;\n mode?: 'url' | 'bundle';\n loadScript?: (javascript: string) => void;\n}) {\n if (new URL(parentOrigin).origin !== parentOrigin)\n throw new Error('Expected an exact parent origin.');\n const documentId = randomUuid();\n let token: string | undefined;\n let sessionId: string | undefined;\n let disposed = false;\n const pending = new Map<string, Pending>();\n let hostState: unknown;\n const stateListeners = new Set<(state: unknown) => void>();\n const logger = createBridgeLogger(\n () =>\n !disposed &&\n !!sessionId &&\n !!hostState &&\n typeof hostState === 'object' &&\n 'logging' in hostState &&\n hostState.logging === true,\n entry => send('runtimeLog', { payload: entry })\n );\n\n const endpoint = createBridgeEndpoint({\n role: 'app',\n origin: parentOrigin,\n source: () => frame.parent,\n opaque: mode === 'bundle',\n context: () => ({ documentId, sessionId, token }),\n post(message) {\n frame.parent.postMessage(message, parentOrigin);\n },\n diagnostic: event => logBridgeDiagnostic(logger, event),\n handlers: {\n connect(message) {\n if (mode === 'bundle') token = message.token;\n send('ready', {});\n },\n initialize(message) {\n if (sessionId && sessionId !== message.sessionId) {\n if (pending.size)\n logger.warn('Preview reconnected; rejecting pending requests', {\n count: pending.size,\n });\n for (const entry of pending.values())\n entry.reject(\n new DataAppError(\n 'The preview reconnected. Retry the request.',\n 'bridge_reset'\n )\n );\n }\n const first = !sessionId;\n sessionId = message.sessionId;\n receiveState(message.state);\n if (first) for (const entry of pending.values()) entry.start();\n if (disposed) return;\n if (mode === 'url') send('runtimeReady', {});\n },\n stateUpdate(message) {\n receiveState(message.state);\n },\n scriptLoad(message) {\n if (mode === 'bundle') loadScript?.(message.javascript);\n },\n result(message) {\n pending.get(message.id)?.resolve(message.response);\n },\n error(message) {\n pending\n .get(message.id)\n ?.reject(\n new MessageRoutingError(\n message.code,\n message.message,\n message.requestId\n )\n );\n },\n },\n });\n const send = endpoint.send;\n const receive = endpoint.receive;\n\n function receiveState(state: unknown) {\n hostState = state;\n for (const listener of stateListeners) listener(state);\n }\n\n frame.addEventListener('message', receive);\n\n function requestMessage(\n message: RoutedMessage,\n signal?: AbortSignal\n ): Promise<unknown> {\n return new Promise((resolve, reject) => {\n if (disposed)\n return reject(\n new DataAppError('The preview has closed.', 'bridge_closed')\n );\n if (signal?.aborted) return reject(signal.reason);\n if (pending.size >= MAX_PENDING)\n return reject(\n new DataAppError('Too many pending data requests.', 'bridge_busy')\n );\n const id = randomUuid();\n let sent = false;\n\n function cleanup() {\n clearTimeout(timer);\n signal?.removeEventListener('abort', abort);\n pending.delete(id);\n }\n\n function abort() {\n if (sent) send('cancel', { id });\n cleanup();\n reject(signal?.reason);\n }\n\n const timer = setTimeout(() => {\n logger.warn('Message request timed out', {\n id,\n route: message.route,\n timeoutMs,\n sent,\n });\n if (sent) send('cancel', { id });\n cleanup();\n reject(\n new DataAppError(\n sessionId\n ? 'The data request timed out.'\n : 'The preview shell is unavailable. Reload the preview.',\n sessionId ? 'timeout' : 'bridge_unavailable'\n )\n );\n }, timeoutMs);\n const entry: Pending = {\n start() {\n if (sent) return;\n try {\n send('request', {\n id,\n route: message.route,\n payload: message.payload,\n });\n sent = true;\n } catch {\n cleanup();\n reject(\n new DataAppError(\n 'The message payload could not be sent.',\n 'invalid_payload'\n )\n );\n }\n },\n resolve(value) {\n cleanup();\n resolve(value);\n },\n reject(error) {\n cleanup();\n reject(error);\n },\n };\n pending.set(id, entry);\n signal?.addEventListener('abort', abort, { once: true });\n if (sessionId) entry.start();\n else if (mode === 'url' || token) send('ready', {});\n });\n }\n\n const messages = createMessageClient(\n { 'data:query': defineDataQueryRoute(), 'data:sql': sqlQueryRoute },\n requestMessage\n );\n\n function queryOperation(\n operation: string,\n input: unknown,\n signal?: AbortSignal\n ): Promise<TransportResponse> {\n return messages\n .request('data:query', { operation, input }, { signal })\n .catch(rethrowDataMessageError);\n }\n\n function disconnect() {\n if (sessionId) send('disconnect', {});\n sessionId = undefined;\n for (const entry of pending.values())\n entry.reject(\n new DataAppError('The preview has closed.', 'bridge_closed')\n );\n }\n\n function resume(event: PageTransitionEvent) {\n if (event.persisted && (mode === 'url' || token)) send('ready', {});\n }\n\n function dispose() {\n if (disposed) return;\n disconnect();\n disposed = true;\n endpoint.dispose();\n frame.removeEventListener('message', receive);\n frame.removeEventListener('pagehide', disconnect);\n frame.removeEventListener('pageshow', resume);\n stateListeners.clear();\n }\n\n frame.addEventListener('pagehide', disconnect);\n frame.addEventListener('pageshow', resume);\n if (mode === 'url') send('ready', {});\n\n return {\n logger,\n request: requestMessage,\n transport: queryOperation,\n lakehouse: {\n queryAll(statement, { limit, signal, params }) {\n return messages\n .request(\n 'data:sql',\n { statement, limit, ...(params === undefined ? {} : { params }) },\n { signal }\n )\n .catch(rethrowDataMessageError);\n },\n } satisfies Lakehouse,\n dispose,\n mode,\n snapshot() {\n return hostState;\n },\n subscribe(listener: (state: unknown) => void) {\n stateListeners.add(listener);\n\n return () => {\n stateListeners.delete(listener);\n };\n },\n ready() {\n if (!disposed && sessionId) send('runtimeReady', {});\n },\n /** Reports a fatal app failure; the cause reaches the host logger only. */\n fail(cause?: unknown) {\n if (disposed || !sessionId) return;\n if (cause !== undefined)\n logger.error(() => ['Data app failed', describeError(cause)]);\n send('runtimeError', {});\n },\n };\n}\n\nexport type IframeTransport = ReturnType<typeof createIframeTransport>;\n\nconst bridgeKey = Symbol.for('altertable.localFrameBridge');\nconst installedKey = Symbol.for('altertable.installedTransport');\ntype LocalBridge = Pick<\n ReturnType<typeof createIframeTransport>,\n 'transport'\n> & { connect?: () => Promise<ReturnType<typeof createIframeTransport>> };\ntype FrameWindow = Window & {\n [bridgeKey]?: LocalBridge;\n [installedKey]?: ReturnType<typeof createIframeTransport>;\n};\n\n/** The URL opts into local preview; only same-origin server configuration establishes trust. */\nexport function localFrameBridge(window?: Window): LocalBridge | undefined {\n const activeWindow =\n window ??\n (typeof globalThis.window === 'undefined' ? undefined : globalThis.window);\n if (!activeWindow) return undefined;\n const frame = activeWindow as FrameWindow;\n if (frame[bridgeKey]) return frame[bridgeKey];\n const parentOrigin =\n new URL(frame.location.href).searchParams.get(PARENT_PARAM) ?? '';\n if (!parentOrigin) return undefined;\n\n async function connect(parentOrigin: string) {\n try {\n const response = await frame.fetch('/__altertable/parent', {\n signal: AbortSignal.timeout(5000),\n });\n const config = (await response.json()) as { origin?: unknown };\n if (\n !response.ok ||\n config.origin !== parentOrigin ||\n frame.parent === frame\n )\n throw new Error('Invalid local parent configuration.');\n // Another owner can install a trusted bridge while configuration is pending.\n if (frame[installedKey]) return frame[installedKey];\n if (frame[bridgeKey] !== proxy)\n throw new Error('Preview transport owner changed.');\n const bridge = createIframeTransport({ parentOrigin, window: frame });\n frame[bridgeKey] = bridge;\n frame[installedKey] = bridge;\n\n return bridge;\n } catch {\n throw new DataAppError(\n 'The preview shell could not be verified. Open the URL printed by altertable app dev.',\n 'bridge_unavailable'\n );\n }\n }\n\n let connection: Promise<ReturnType<typeof createIframeTransport>> | undefined;\n\n function getConnection() {\n const installed = frame[installedKey];\n if (installed) return Promise.resolve(installed);\n if (!connection) {\n const attempt = connect(parentOrigin);\n connection = attempt;\n // Clear only this failed attempt; retained proxy references can explicitly retry.\n void attempt.catch(() => {\n if (connection === attempt) connection = undefined;\n });\n }\n\n return connection;\n }\n\n const proxy: LocalBridge = {\n async transport(operation, input, signal) {\n signal?.throwIfAborted();\n const attempt = getConnection();\n let abort: (() => void) | undefined;\n try {\n const bridge = signal\n ? await Promise.race([\n attempt,\n new Promise<never>((_, reject) => {\n const requestSignal = signal;\n\n function handleAbort() {\n reject(requestSignal.reason);\n }\n\n abort = handleAbort;\n requestSignal.addEventListener('abort', handleAbort, {\n once: true,\n });\n }),\n ])\n : await attempt;\n signal?.throwIfAborted();\n\n return bridge.transport(operation, input, signal);\n } finally {\n if (abort) signal?.removeEventListener('abort', abort);\n }\n },\n connect: getConnection,\n };\n frame[bridgeKey] = proxy;\n // Static mounting still verifies eagerly, without an unhandled rejection.\n void getConnection().catch(() => {});\n\n return proxy;\n}\n\n/** Install an explicitly trusted transport for hosted apps and their URL-backed controls. */\nexport function installDataAppTransport(\n bridge: ReturnType<typeof createIframeTransport>,\n frame: Window = window\n) {\n const target = frame as FrameWindow;\n if (target[installedKey])\n throw new Error('A data app transport is already installed.');\n target[bridgeKey] = bridge;\n target[installedKey] = bridge;\n\n return () => {\n if (target[bridgeKey] === bridge) delete target[bridgeKey];\n if (target[installedKey] === bridge) delete target[installedKey];\n bridge.dispose();\n };\n}\n\n/** The bootstrap installs this before executing app code. URL apps can install an explicit connection. */\nexport function getDataAppTransport(frame: Window = window) {\n return (frame as FrameWindow)[installedKey];\n}\n"
9
- ],
10
- "mappings": ";;;;;;;;;;;;;;AASA,IAAM,aAAa,OAAO,IAAI,mCAAmC;AAAA;AAE1D,MAAM,sBAAqB,MAAM;AAAA,EAYpB;AAAA,EACA;AAAA,GAZR,cAAc;AAAA,UAEhB,OAAO,YAAY,CAAC,OAAyB;AAAA,IACnD,OACE,iBAAiB,SAChB,MAAqC,gBAAgB;AAAA;AAAA,EAI1D,WAAW,CACT,SACgB,MACA,WAChB;AAAA,IACA,MAAM,OAAO;AAAA,IAHG;AAAA,IACA;AAAA,IAGhB,KAAK,OAAO;AAAA;AAEhB;AAEO,SAAS,oBAAmB;AAAA,EACjC,WAAW;AAAA,EACX,OAAO,UAAU,WAAW;AAAA,IAI1B,CAAC,GAAkB;AAAA,EACrB,eAAe,WAAW,CACxB,WACA,OACA,QAC4B;AAAA,IAC5B,MAAM,WAAW,MAAM,QACrB,GAAG,SAAS,QAAQ,OAAO,EAAE,KAAK,mBAAmB,SAAS,KAC9D;AAAA,MACE,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU,KAAK;AAAA,MAC1B;AAAA,IACF,CACF;AAAA,IACA,IAAI;AAAA,MACF,OAAO,EAAE,QAAQ,SAAS,QAAQ,MAAM,MAAM,SAAS,KAAK,EAAE;AAAA,MAC9D,OAAO,OAAO;AAAA,MACd,IAAI,QAAQ;AAAA,QAAS,MAAM;AAAA,MAC3B,MAAM,IAAI,cACR,SAAS,KAAK,mCAAmC,wBACjD,SAAS,KAAK,qBAAqB,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,SAAS,wBAAuB,CACrC,QACA,QAAgB,QAChB;AAAA,EACA,MAAM,SAAS;AAAA,EACf,IAAI,OAAO;AAAA,IACT,MAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D,OAAO,aAAa;AAAA,EACpB,OAAO,gBAAgB;AAAA,EAEvB,OAAO,MAAM;AAAA,IACX,IAAI,OAAO,eAAe;AAAA,MAAQ,OAAO,OAAO;AAAA,IAChD,IAAI,OAAO,kBAAkB;AAAA,MAAQ,OAAO,OAAO;AAAA,IACnD,OAAO,QAAQ;AAAA;AAAA;AAKZ,SAAS,oBAAmB,CAAC,QAAgB,QAAQ;AAAA,EAC1D,OAAQ,MAAsB;AAAA;",
11
- "debugId": "7D24D9E55722CFC964756E2164756E21",
12
- "names": []
13
- }
@@ -1,80 +0,0 @@
1
- import {
2
- executeDataOperation,
3
- toDataOperationFailure
4
- } from "./index-r7b1ftwy.js";
5
- import {
6
- DataAppError2,
7
- createHttpTransport2,
8
- localFrameBridge,
9
- getDataAppTransport2
10
- } from "./index-2sbp9h2b.js";
11
- import {
12
- randomUuid
13
- } from "./index-wss3gd3h.js";
14
- import {
15
- MessageRoutingError2,
16
- defineDataQueryRoute2
17
- } from "./index-zcqxfwdq.js";
18
-
19
- // src/client/data-client.ts
20
- var dataQueryRoute = defineDataQueryRoute2();
21
- function createDataClient2(options = {}) {
22
- if (options.operations)
23
- return createOperationClient({
24
- operations: options.operations,
25
- lakehouse: options.lakehouse
26
- });
27
- const http = createHttpTransport2(options);
28
- const useHttp = options.endpoint !== undefined || options.fetch !== undefined;
29
- return {
30
- async query(name, input, { signal } = {}) {
31
- const transport = options.transport ?? (useHttp ? http : localFrameBridge()?.transport ?? http);
32
- const response = await transport(name, input, signal);
33
- const ok = response.status >= 200 && response.status < 300;
34
- let body;
35
- try {
36
- body = dataQueryRoute.output(response, { operation: name, input }).body;
37
- } catch (error) {
38
- if (signal?.aborted)
39
- throw error;
40
- if (error instanceof MessageRoutingError2)
41
- throw new DataAppError2(error.message, error.code, error.requestId);
42
- throw new DataAppError2(ok ? "The data response was invalid." : "Could not load data.", ok ? "invalid_response" : "request_failed");
43
- }
44
- return { ...body, input };
45
- }
46
- };
47
- }
48
- function createOperationClient(options) {
49
- return {
50
- async query(name, input, { signal } = {}) {
51
- signal?.throwIfAborted();
52
- const requestId = randomUuid();
53
- if (!Object.hasOwn(options.operations, name))
54
- throw new DataAppError2("Unknown data operation.", "not_found", requestId);
55
- const lakehouse = options.lakehouse ?? (typeof window === "undefined" ? undefined : getDataAppTransport2()?.lakehouse);
56
- if (!lakehouse)
57
- throw new DataAppError2("An authorized SQL bridge must be installed first.", "bridge_unavailable", requestId);
58
- try {
59
- const { body } = await executeDataOperation(options.operations[name], input, {
60
- lakehouse,
61
- signal: signal ?? new AbortController().signal,
62
- requestId,
63
- operationName: name
64
- });
65
- return { ...body, input };
66
- } catch (error) {
67
- if (signal?.aborted)
68
- throw signal.reason;
69
- if (error instanceof DataAppError2)
70
- throw error;
71
- const failure = toDataOperationFailure(error);
72
- throw new DataAppError2(failure.message, failure.code, requestId);
73
- }
74
- }
75
- };
76
- }
77
-
78
- export { createDataClient2 };
79
-
80
- //# debugId=F1FFBCC98547BBCD64756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/client/data-client.ts"],
4
- "sourcesContent": [
5
- "import { randomUuid } from '@/src/core/uuid';\nimport { createHttpTransport, DataAppError } from '@/src/client/transport';\nimport { getDataAppTransport, localFrameBridge } from '@/src/client/iframe';\nimport {\n executeDataOperation,\n toDataOperationFailure,\n} from '@/src/core/operation';\nimport type { DataOperations, Lakehouse } from '@/src/core/contract';\nimport { defineDataQueryRoute, MessageRoutingError } from '@/src/core/messages';\nimport type { DataTransport } from '@/src/client/transport';\nimport type {\n DataQueryBody,\n InputOf,\n OutputOf,\n} from '@/src/core/operation-types';\nexport type { InputOf, OutputOf } from '@/src/core/operation-types';\n\n/**\n * Parsed operation data and query evidence.\n */\nexport type DataResponse<Output, Input = unknown> = DataQueryBody<Output> & {\n /** The exact browser input that produced this response. */\n input: Input;\n};\n\nexport type DataClient<Operations extends DataOperations> = {\n query<Name extends keyof Operations & string>(\n name: Name,\n input: InputOf<Operations[Name]>,\n options?: { signal?: AbortSignal }\n ): Promise<\n DataResponse<OutputOf<Operations[Name]>, InputOf<Operations[Name]>>\n >;\n};\n\n/** Browser operations and named-operation delivery are mutually exclusive configurations. */\nexport type DataClientOptions<Operations extends DataOperations> =\n | {\n operations: Operations;\n lakehouse?: Lakehouse;\n transport?: never;\n endpoint?: never;\n fetch?: never;\n }\n | {\n operations?: never;\n lakehouse?: never;\n transport?: DataTransport;\n endpoint?: string;\n fetch?: typeof fetch;\n };\n\nconst dataQueryRoute = defineDataQueryRoute();\n\n/** Named HTTP operations, or browser-owned operations executed through an authorized SQL bridge. */\nexport function createDataClient<Operations extends DataOperations>(\n options: DataClientOptions<Operations> = {}\n): DataClient<Operations> {\n if (options.operations)\n return createOperationClient({\n operations: options.operations,\n lakehouse: options.lakehouse,\n });\n const http = createHttpTransport(options);\n const useHttp = options.endpoint !== undefined || options.fetch !== undefined;\n\n return {\n async query(name, input, { signal } = {}) {\n const transport =\n options.transport ??\n (useHttp ? http : (localFrameBridge()?.transport ?? http));\n const response = await transport(name, input, signal);\n const ok = response.status >= 200 && response.status < 300;\n let body: Omit<DataResponse<OutputOf<Operations[typeof name]>>, 'input'>;\n try {\n body = dataQueryRoute.output(response, { operation: name, input })\n .body as typeof body;\n } catch (error) {\n if (signal?.aborted) throw error;\n if (error instanceof MessageRoutingError)\n throw new DataAppError(error.message, error.code, error.requestId);\n throw new DataAppError(\n ok ? 'The data response was invalid.' : 'Could not load data.',\n ok ? 'invalid_response' : 'request_failed'\n );\n }\n\n return { ...body, input };\n },\n };\n}\n\nfunction createOperationClient<Operations extends DataOperations>(options: {\n operations: Operations;\n lakehouse?: Lakehouse;\n}): DataClient<Operations> {\n return {\n async query(name, input, { signal } = {}) {\n signal?.throwIfAborted();\n const requestId = randomUuid();\n if (!Object.hasOwn(options.operations, name))\n throw new DataAppError(\n 'Unknown data operation.',\n 'not_found',\n requestId\n );\n const lakehouse =\n options.lakehouse ??\n (typeof window === 'undefined'\n ? undefined\n : getDataAppTransport()?.lakehouse);\n if (!lakehouse)\n throw new DataAppError(\n 'An authorized SQL bridge must be installed first.',\n 'bridge_unavailable',\n requestId\n );\n\n try {\n const { body } = await executeDataOperation(\n options.operations[name]!,\n input,\n {\n lakehouse,\n signal: signal ?? new AbortController().signal,\n requestId,\n operationName: name,\n }\n );\n\n return { ...body, input } as DataResponse<\n OutputOf<Operations[typeof name]>,\n InputOf<Operations[typeof name]>\n >;\n } catch (error) {\n if (signal?.aborted) throw signal.reason;\n if (error instanceof DataAppError) throw error;\n const failure = toDataOperationFailure(error);\n throw new DataAppError(failure.message, failure.code, requestId);\n }\n },\n };\n}\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;AAoDA,IAAM,iBAAiB,sBAAqB;AAGrC,SAAS,iBAAmD,CACjE,UAAyC,CAAC,GAClB;AAAA,EACxB,IAAI,QAAQ;AAAA,IACV,OAAO,sBAAsB;AAAA,MAC3B,YAAY,QAAQ;AAAA,MACpB,WAAW,QAAQ;AAAA,IACrB,CAAC;AAAA,EACH,MAAM,OAAO,qBAAoB,OAAO;AAAA,EACxC,MAAM,UAAU,QAAQ,aAAa,aAAa,QAAQ,UAAU;AAAA,EAEpE,OAAO;AAAA,SACC,MAAK,CAAC,MAAM,SAAS,WAAW,CAAC,GAAG;AAAA,MACxC,MAAM,YACJ,QAAQ,cACP,UAAU,OAAQ,iBAAiB,GAAG,aAAa;AAAA,MACtD,MAAM,WAAW,MAAM,UAAU,MAAM,OAAO,MAAM;AAAA,MACpD,MAAM,KAAK,SAAS,UAAU,OAAO,SAAS,SAAS;AAAA,MACvD,IAAI;AAAA,MACJ,IAAI;AAAA,QACF,OAAO,eAAe,OAAO,UAAU,EAAE,WAAW,MAAM,MAAM,CAAC,EAC9D;AAA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+0,0 @@
1
- // src/core/appearance.ts
2
- var defaults = {
3
- theme: "light",
4
- baseColor: "neutral",
5
- accentColor: "#202124",
6
- darkAccentColor: "#f2f3f4",
7
- chartColors: [
8
- "#285fc0",
9
- "#a95319",
10
- "#147862",
11
- "#7243aa",
12
- "#aa3958",
13
- "#475569"
14
- ],
15
- density: "comfortable",
16
- cornerRadius: "medium",
17
- elevation: "subtle",
18
- typography: { body: "system", heading: "system" }
19
- };
20
- function record(value) {
21
- return typeof value === "object" && value !== null && !Array.isArray(value);
22
- }
23
- function oneOf(value, options) {
24
- return typeof value === "string" && options.includes(value);
25
- }
26
- function color(value) {
27
- return typeof value === "string" && /^#[0-9a-fA-F]{6}$/.test(value);
28
- }
29
- function font(value) {
30
- return typeof value === "string" && value.length > 0 && value.length <= 120 && !/[;{}()]/.test(value);
31
- }
32
- function parseAppearance2(value) {
33
- if (!record(value))
34
- return normalizeAppearance2();
35
- const typography = record(value.typography) ? value.typography : {};
36
- return normalizeAppearance2({
37
- theme: oneOf(value.theme, ["light", "dark", "system"]) ? value.theme : undefined,
38
- baseColor: oneOf(value.baseColor, ["neutral", "slate", "warm"]) ? value.baseColor : undefined,
39
- accentColor: color(value.accentColor) ? value.accentColor : undefined,
40
- darkAccentColor: color(value.darkAccentColor) ? value.darkAccentColor : undefined,
41
- chartColors: Array.isArray(value.chartColors) && value.chartColors.length >= 1 && value.chartColors.length <= 8 && value.chartColors.every(color) ? value.chartColors : undefined,
42
- density: oneOf(value.density, ["compact", "comfortable", "spacious"]) ? value.density : undefined,
43
- cornerRadius: oneOf(value.cornerRadius, [
44
- "none",
45
- "small",
46
- "medium",
47
- "large"
48
- ]) ? value.cornerRadius : undefined,
49
- elevation: oneOf(value.elevation, ["flat", "subtle", "raised"]) ? value.elevation : undefined,
50
- typography: {
51
- body: font(typography.body) ? typography.body : undefined,
52
- heading: font(typography.heading) ? typography.heading : undefined
53
- }
54
- });
55
- }
56
- function normalizeAppearance2(value = {}) {
57
- return {
58
- theme: value.theme ?? defaults.theme,
59
- baseColor: value.baseColor ?? defaults.baseColor,
60
- accentColor: value.accentColor ?? defaults.accentColor,
61
- density: value.density ?? defaults.density,
62
- cornerRadius: value.cornerRadius ?? defaults.cornerRadius,
63
- elevation: value.elevation ?? defaults.elevation,
64
- darkAccentColor: value.darkAccentColor ?? (value.accentColor === undefined ? defaults.darkAccentColor : undefined),
65
- chartColors: [...value.chartColors ?? defaults.chartColors],
66
- typography: {
67
- body: value.typography?.body ?? defaults.typography.body,
68
- heading: value.typography?.heading ?? defaults.typography.heading
69
- }
70
- };
71
- }
72
- function fontStack(family) {
73
- return family === "system" ? "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, ui-sans-serif, sans-serif" : `${JSON.stringify(family)}, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, ui-sans-serif, sans-serif`;
74
- }
75
- function accentForeground(settings, dark) {
76
- const accent = getComputedStyle(document.documentElement).getPropertyValue("--atbl-accent") || (dark ? settings.darkAccentColor ?? `color-mix(in srgb, ${settings.accentColor} 50%, white)` : settings.accentColor);
77
- const canvas = document.createElement("canvas");
78
- canvas.width = canvas.height = 1;
79
- const context = canvas.getContext("2d");
80
- context.fillStyle = accent;
81
- context.fillRect(0, 0, 1, 1);
82
- const channels = [...context.getImageData(0, 0, 1, 1).data].slice(0, 3).map((value) => {
83
- const channel = value / 255;
84
- return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
85
- });
86
- const luminance = channels[0] * 0.2126 + channels[1] * 0.7152 + channels[2] * 0.0722;
87
- return (luminance + 0.05) / 0.05 > 1.05 / (luminance + 0.05) ? "#000000" : "#ffffff";
88
- }
89
- function applyAppearance2(value) {
90
- const settings = normalizeAppearance2(value);
91
- const root = document.documentElement;
92
- const preference = window.matchMedia("(prefers-color-scheme: dark)");
93
- const attributes = {
94
- "data-atbl-appearance": "",
95
- "data-atbl-base-color": settings.baseColor,
96
- "data-atbl-density": settings.density,
97
- "data-atbl-radius": settings.cornerRadius,
98
- "data-atbl-elevation": settings.elevation,
99
- "data-atbl-theme": ""
100
- };
101
- const inputs = {
102
- "--atbl-input-font": fontStack(settings.typography.body),
103
- "--atbl-input-font-heading": fontStack(settings.typography.heading),
104
- "--atbl-input-accent": settings.accentColor,
105
- "--atbl-input-dark-accent": settings.darkAccentColor ?? `color-mix(in srgb, ${settings.accentColor} 50%, white)`,
106
- "--atbl-input-on-accent": ""
107
- };
108
- const chartColors = settings.chartColors.length ? settings.chartColors : defaults.chartColors;
109
- for (let index = 0;index < 8; index++)
110
- inputs[`--atbl-input-chart-${index + 1}`] = chartColors[index % chartColors.length];
111
- const previousAttributes = Object.keys(attributes).map((name) => [name, root.getAttribute(name)]);
112
- const previousInputs = Object.keys(inputs).map((name) => [
113
- name,
114
- root.style.getPropertyValue(name),
115
- root.style.getPropertyPriority(name)
116
- ]);
117
- for (const [name, token] of Object.entries(inputs)) {
118
- if (token)
119
- root.style.setProperty(name, token);
120
- else
121
- root.style.removeProperty(name);
122
- }
123
- for (const [name, attribute] of Object.entries(attributes))
124
- root.setAttribute(name, attribute);
125
- function applyTheme() {
126
- const dark = settings.theme === "dark" || settings.theme === "system" && preference.matches;
127
- root.setAttribute("data-atbl-theme", dark ? "dark" : "light");
128
- root.style.setProperty("--atbl-input-on-accent", accentForeground(settings, dark));
129
- }
130
- applyTheme();
131
- if (settings.theme === "system")
132
- preference.addEventListener("change", applyTheme);
133
- return () => {
134
- preference.removeEventListener("change", applyTheme);
135
- for (const [name, attribute] of previousAttributes) {
136
- if (attribute === null)
137
- root.removeAttribute(name);
138
- else
139
- root.setAttribute(name, attribute);
140
- }
141
- for (const [name, token, priority] of previousInputs) {
142
- if (token)
143
- root.style.setProperty(name, token, priority);
144
- else
145
- root.style.removeProperty(name);
146
- }
147
- };
148
- }
149
- function createThemeController2(initialTheme = "light") {
150
- const storageKey = "altertable.data-app.theme";
151
- let theme = initialTheme;
152
- try {
153
- const saved = window.localStorage.getItem(storageKey);
154
- if (oneOf(saved, ["light", "dark", "system"]))
155
- theme = saved;
156
- } catch {}
157
- const listeners = new Set;
158
- return {
159
- getTheme() {
160
- return theme;
161
- },
162
- setTheme(nextTheme) {
163
- if (nextTheme === theme)
164
- return;
165
- theme = nextTheme;
166
- try {
167
- window.localStorage.setItem(storageKey, theme);
168
- } catch {}
169
- listeners.forEach((listener) => listener());
170
- },
171
- subscribe(listener) {
172
- listeners.add(listener);
173
- return () => listeners.delete(listener);
174
- }
175
- };
176
- }
177
-
178
- export { parseAppearance2, normalizeAppearance2, applyAppearance2, createThemeController2 };
179
-
180
- //# debugId=FEC902AF3AD81A9464756E2164756E21