@malloy-publisher/sdk 0.9.1 → 0.9.3

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 (410) hide show
  1. package/dist/{RenderedResult-BRgIgxWh.es.js → RenderedResult-DwB0-9Yx.es.js} +219 -210
  2. package/dist/RenderedResult-hKjFEqaN.cjs.js +141 -0
  3. package/dist/{ServerProvider-Boxrv6Ym.es.js → ServerProvider-CcSrGaRN.es.js} +1473 -1326
  4. package/dist/ServerProvider-Gbf1YPOP.cjs.js +1 -0
  5. package/dist/builder/index.cjs.js +143 -58
  6. package/dist/builder/index.es.js +12179 -9318
  7. package/dist/builder-entry.d.ts +5 -1
  8. package/dist/client/api.d.ts +247 -56
  9. package/dist/client/configuration.d.ts +1 -1
  10. package/dist/client/index.cjs.js +1 -1
  11. package/dist/client/index.d.ts +1 -1
  12. package/dist/client/index.es.js +94 -88
  13. package/dist/client-entry.d.ts +2 -0
  14. package/dist/components/ApiErrorDisplay.d.ts +11 -0
  15. package/dist/components/AppDialog.d.ts +6 -6
  16. package/dist/components/Dashboard/Dashboard.d.ts +8 -15
  17. package/dist/components/Dashboard/DashboardGrid.d.ts +38 -6
  18. package/dist/components/Dashboard/DashboardTile.d.ts +21 -2
  19. package/dist/components/Dashboard/DashboardView.d.ts +71 -0
  20. package/dist/components/Dashboard/TileCard.d.ts +30 -5
  21. package/dist/components/Dashboard/TileFilterTag.d.ts +12 -0
  22. package/dist/components/Dashboard/dropValueUrlTags.d.ts +6 -0
  23. package/dist/components/Dashboard/index.d.ts +5 -1
  24. package/dist/components/Dashboard/telemetry.d.ts +16 -3
  25. package/dist/components/Dashboard/textSource.d.ts +19 -0
  26. package/dist/components/DashboardBuilder/AddTileDialog.d.ts +15 -9
  27. package/dist/components/DashboardBuilder/BuilderDialogs.d.ts +25 -0
  28. package/dist/components/DashboardBuilder/BuilderGrid.d.ts +31 -0
  29. package/dist/components/DashboardBuilder/BuilderHeader.d.ts +17 -0
  30. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +23 -15
  31. package/dist/components/DashboardBuilder/ChartPicker.d.ts +31 -0
  32. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +56 -21
  33. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +44 -5
  34. package/dist/components/DashboardBuilder/EditorSurface.d.ts +33 -0
  35. package/dist/components/DashboardBuilder/FilterDialog.d.ts +2 -2
  36. package/dist/components/DashboardBuilder/FilterStrip.d.ts +8 -4
  37. package/dist/components/DashboardBuilder/InlineMarkdown.d.ts +18 -0
  38. package/dist/components/DashboardBuilder/InlineText.d.ts +19 -0
  39. package/dist/components/DashboardBuilder/NotebookEditor.d.ts +15 -0
  40. package/dist/components/DashboardBuilder/SourceViewPicker.d.ts +9 -0
  41. package/dist/components/DashboardBuilder/TextTileBody.d.ts +10 -0
  42. package/dist/components/DashboardBuilder/TileFrame.d.ts +51 -12
  43. package/dist/components/DashboardBuilder/TileMenu.d.ts +12 -6
  44. package/dist/components/DashboardBuilder/annotationText.d.ts +4 -0
  45. package/dist/components/DashboardBuilder/builderReport.d.ts +13 -0
  46. package/dist/components/DashboardBuilder/catalog.d.ts +4 -18
  47. package/dist/components/DashboardBuilder/changedTile.d.ts +7 -0
  48. package/dist/components/DashboardBuilder/chartLine.d.ts +33 -0
  49. package/dist/components/DashboardBuilder/controls.d.ts +2 -2
  50. package/dist/components/DashboardBuilder/document.d.ts +42 -26
  51. package/dist/components/DashboardBuilder/documentSession.d.ts +100 -0
  52. package/dist/components/DashboardBuilder/imports.d.ts +19 -0
  53. package/dist/components/DashboardBuilder/inlineEdit.d.ts +18 -0
  54. package/dist/components/DashboardBuilder/legacyNotebook.d.ts +73 -0
  55. package/dist/components/DashboardBuilder/loadMalloy.d.ts +15 -0
  56. package/dist/components/DashboardBuilder/malloyTree.d.ts +119 -0
  57. package/dist/components/DashboardBuilder/newDashboard.d.ts +3 -1
  58. package/dist/components/DashboardBuilder/openDraft.d.ts +10 -0
  59. package/dist/components/DashboardBuilder/preview.d.ts +24 -4
  60. package/dist/components/DashboardBuilder/readDocument.d.ts +6 -1
  61. package/dist/components/DashboardBuilder/readForEditor.d.ts +16 -0
  62. package/dist/components/DashboardBuilder/sortable.d.ts +16 -0
  63. package/dist/components/DashboardBuilder/spliceDocument.d.ts +15 -13
  64. package/dist/components/DashboardBuilder/spliceResult.d.ts +11 -0
  65. package/dist/components/DashboardBuilder/tagParse.d.ts +24 -0
  66. package/dist/components/DashboardBuilder/telemetry.d.ts +43 -0
  67. package/dist/components/DashboardBuilder/testing/fixtures.d.ts +3 -1
  68. package/dist/components/DashboardBuilder/testing/inline.d.ts +4 -0
  69. package/dist/components/DashboardBuilder/testing/resize.d.ts +7 -0
  70. package/dist/components/DashboardBuilder/tileDisplayTitle.d.ts +7 -0
  71. package/dist/components/DashboardBuilder/useBuilderSelection.d.ts +53 -0
  72. package/dist/components/DashboardBuilder/useBuilderSession.d.ts +86 -0
  73. package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +9 -6
  74. package/dist/components/DashboardBuilder/useControlBindings.d.ts +30 -0
  75. package/dist/components/DashboardBuilder/useConversionConfirm.d.ts +20 -0
  76. package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +19 -55
  77. package/dist/components/DashboardBuilder/useDocumentEditor.d.ts +105 -0
  78. package/dist/components/DashboardBuilder/useDraft.d.ts +3 -1
  79. package/dist/components/DashboardBuilder/useExitGuard.d.ts +19 -0
  80. package/dist/components/DashboardBuilder/useFilterForm.d.ts +3 -3
  81. package/dist/components/DashboardBuilder/useHostCopy.d.ts +26 -0
  82. package/dist/components/DashboardBuilder/useOpenDraftCommit.d.ts +17 -0
  83. package/dist/components/DashboardBuilder/useOpenedDocument.d.ts +71 -0
  84. package/dist/components/DashboardBuilder/useSaveChannel.d.ts +50 -0
  85. package/dist/components/DashboardBuilder/useTileEditing.d.ts +33 -0
  86. package/dist/components/DashboardBuilder/useTileResize.d.ts +6 -3
  87. package/dist/components/DocumentCreate/canRetry.d.ts +6 -0
  88. package/dist/components/DocumentCreate/createDocument.d.ts +58 -0
  89. package/dist/components/DocumentCreate/documentPath.d.ts +10 -0
  90. package/dist/components/DocumentCreate/events.d.ts +10 -0
  91. package/dist/components/DocumentCreate/exportedSources.d.ts +7 -0
  92. package/dist/components/DocumentCreate/guards.d.ts +12 -0
  93. package/dist/components/DocumentCreate/index.d.ts +6 -0
  94. package/dist/components/DocumentCreate/newNotebook.d.ts +9 -0
  95. package/dist/components/DocumentCreate/useDocumentChoices.d.ts +32 -0
  96. package/dist/components/DocumentStorage/DocumentStorage.d.ts +2 -1
  97. package/dist/components/Loading.d.ts +13 -0
  98. package/dist/components/NarrowEditGate.d.ts +8 -0
  99. package/dist/components/Notebook/Notebook.d.ts +1 -1
  100. package/dist/components/Notebook/NotebookCell.d.ts +1 -5
  101. package/dist/components/Package/NewDocumentDialog.d.ts +33 -0
  102. package/dist/components/Package/Package.d.ts +17 -1
  103. package/dist/components/Package/documentLocation.d.ts +28 -0
  104. package/dist/components/Package/index.d.ts +5 -1
  105. package/dist/components/Package/useDocumentLocation.d.ts +12 -0
  106. package/dist/components/PackageSection.d.ts +2 -2
  107. package/dist/components/Prose.d.ts +1 -1
  108. package/dist/components/RenderedResult/RenderedResult.d.ts +2 -0
  109. package/dist/components/RenderedResult/ResultContainer.d.ts +8 -1
  110. package/dist/components/RenderedResult/ResultPanel.d.ts +3 -1
  111. package/dist/components/RenderedResult/loadRenderer.d.ts +7 -0
  112. package/dist/components/RenderedResult/resultSizing.d.ts +9 -1
  113. package/dist/components/ServerProvider.d.ts +2 -1
  114. package/dist/components/UnsavedChangesDialog.d.ts +9 -0
  115. package/dist/components/given/GivensPanel.d.ts +2 -2
  116. package/dist/components/given/paramCodec.d.ts +8 -1
  117. package/dist/components/index.d.ts +3 -2
  118. package/dist/components/styles.d.ts +4 -4
  119. package/dist/hooks/givenValue.d.ts +6 -0
  120. package/dist/hooks/index.d.ts +2 -0
  121. package/dist/hooks/useCompiledDocument.d.ts +23 -0
  122. package/dist/hooks/useDocumentControls.d.ts +6 -1
  123. package/dist/hooks/useNarrowScreen.d.ts +4 -0
  124. package/dist/hooks/useNearViewport.d.ts +16 -0
  125. package/dist/hooks/useQueryResult.d.ts +2 -0
  126. package/dist/hooks/useQueryWithApiError.d.ts +7 -2
  127. package/dist/hooks/useSettled.d.ts +14 -0
  128. package/dist/hooks/useSuggestOptions.d.ts +9 -2
  129. package/dist/index.cjs.js +23 -24
  130. package/dist/index.es.js +9041 -7002
  131. package/dist/text/index.cjs.js +1 -0
  132. package/dist/text/index.d.ts +2 -0
  133. package/dist/text/index.es.js +6 -0
  134. package/dist/text-entry-BJwltZiy.cjs.js +7 -0
  135. package/dist/text-entry-CA0LZ1xL.es.js +196 -0
  136. package/dist/text-entry.d.ts +2 -0
  137. package/dist/theme/accent.d.ts +29 -0
  138. package/dist/theme/buildVegaThemeOverride.d.ts +3 -3
  139. package/dist/theme/index.d.ts +3 -0
  140. package/dist/theme/keys.d.ts +1 -1
  141. package/dist/theme/motion.d.ts +31 -0
  142. package/dist/theme/readChartAnnotations.d.ts +1 -1
  143. package/dist/theme/resolveTheme.d.ts +4 -4
  144. package/dist/theme/types.d.ts +33 -5
  145. package/dist/{Dashboard-H1kJlDFo.es.js → useCompiledDocument-BU6d8FPp.es.js} +17904 -19057
  146. package/dist/useCompiledDocument-pOg2W-Yt.cjs.js +142 -0
  147. package/dist/utils/clock.d.ts +2 -0
  148. package/dist/utils/malloyText.d.ts +104 -0
  149. package/package.json +20 -11
  150. package/src/builder-entry.ts +36 -0
  151. package/src/client-entry.ts +8 -0
  152. package/src/clientEntry.spec.ts +17 -0
  153. package/src/components/ApiErrorDisplay.tsx +37 -18
  154. package/src/components/AppDialog.tsx +8 -7
  155. package/src/components/Dashboard/Dashboard.spec.tsx +3 -32
  156. package/src/components/Dashboard/Dashboard.tsx +29 -280
  157. package/src/components/Dashboard/DashboardGrid.tsx +87 -8
  158. package/src/components/Dashboard/DashboardTile.spec.tsx +121 -2
  159. package/src/components/Dashboard/DashboardTile.tsx +121 -30
  160. package/src/components/Dashboard/DashboardView.spec.tsx +368 -0
  161. package/src/components/Dashboard/DashboardView.tsx +428 -0
  162. package/src/components/Dashboard/RowsDialog.tsx +4 -3
  163. package/src/components/Dashboard/TileCard.tsx +60 -11
  164. package/src/components/Dashboard/TileFilterTag.spec.tsx +73 -0
  165. package/src/components/Dashboard/TileFilterTag.tsx +78 -0
  166. package/src/components/Dashboard/defaultTileSpan.spec.ts +32 -0
  167. package/src/components/Dashboard/dropValueUrlTags.spec.ts +177 -0
  168. package/src/components/Dashboard/dropValueUrlTags.ts +108 -0
  169. package/src/components/Dashboard/index.ts +13 -1
  170. package/src/components/Dashboard/telemetry.ts +17 -5
  171. package/src/components/Dashboard/textSource.spec.ts +36 -0
  172. package/src/components/Dashboard/textSource.ts +39 -0
  173. package/src/components/DashboardBuilder/AddTileDialog.spec.tsx +88 -0
  174. package/src/components/DashboardBuilder/AddTileDialog.tsx +124 -138
  175. package/src/components/DashboardBuilder/BuilderDialogs.tsx +162 -0
  176. package/src/components/DashboardBuilder/BuilderGrid.tsx +245 -0
  177. package/src/components/DashboardBuilder/BuilderHeader.tsx +107 -0
  178. package/src/components/DashboardBuilder/BuilderToolbar.tsx +111 -80
  179. package/src/components/DashboardBuilder/ChartPicker.render.spec.tsx +25 -0
  180. package/src/components/DashboardBuilder/ChartPicker.spec.ts +77 -0
  181. package/src/components/DashboardBuilder/ChartPicker.tsx +156 -0
  182. package/src/components/DashboardBuilder/DashboardBuilder.charts.spec.tsx +205 -0
  183. package/src/components/DashboardBuilder/DashboardBuilder.exit.spec.tsx +183 -0
  184. package/src/components/DashboardBuilder/DashboardBuilder.inline.spec.tsx +373 -0
  185. package/src/components/DashboardBuilder/DashboardBuilder.notebook.spec.tsx +310 -0
  186. package/src/components/DashboardBuilder/DashboardBuilder.openDraft.spec.tsx +105 -0
  187. package/src/components/DashboardBuilder/DashboardBuilder.sources.spec.tsx +117 -0
  188. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +146 -108
  189. package/src/components/DashboardBuilder/DashboardBuilder.textTiles.spec.tsx +179 -0
  190. package/src/components/DashboardBuilder/DashboardBuilder.tsx +330 -512
  191. package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +55 -25
  192. package/src/components/DashboardBuilder/DashboardEditor.emptyStart.spec.tsx +142 -0
  193. package/src/components/DashboardBuilder/DashboardEditor.filterTag.spec.tsx +162 -0
  194. package/src/components/DashboardBuilder/DashboardEditor.notebook.spec.tsx +310 -0
  195. package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +39 -13
  196. package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +9 -26
  197. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +102 -25
  198. package/src/components/DashboardBuilder/DashboardEditor.textSource.spec.tsx +317 -0
  199. package/src/components/DashboardBuilder/DashboardEditor.tsx +252 -780
  200. package/src/components/DashboardBuilder/DrillDialog.tsx +2 -2
  201. package/src/components/DashboardBuilder/EditorSurface.tsx +471 -0
  202. package/src/components/DashboardBuilder/FilterDialog.tsx +23 -11
  203. package/src/components/DashboardBuilder/FilterStrip.tsx +130 -70
  204. package/src/components/DashboardBuilder/InlineMarkdown.tsx +182 -0
  205. package/src/components/DashboardBuilder/InlineText.tsx +112 -0
  206. package/src/components/DashboardBuilder/NotebookEditor.tsx +44 -0
  207. package/src/components/DashboardBuilder/SourceViewPicker.tsx +122 -0
  208. package/src/components/DashboardBuilder/TextTileBody.tsx +31 -0
  209. package/src/components/DashboardBuilder/TileFrame.tsx +302 -163
  210. package/src/components/DashboardBuilder/TileMenu.tsx +125 -97
  211. package/src/components/DashboardBuilder/annotationText.spec.ts +33 -0
  212. package/src/components/DashboardBuilder/annotationText.ts +17 -0
  213. package/src/components/DashboardBuilder/artifactBlock.spec.ts +248 -0
  214. package/src/components/DashboardBuilder/artifactTagParity.spec.ts +46 -0
  215. package/src/components/DashboardBuilder/builderReport.ts +74 -0
  216. package/src/components/DashboardBuilder/catalog.aggregate.spec.ts +49 -0
  217. package/src/components/DashboardBuilder/catalog.spec.ts +2 -44
  218. package/src/components/DashboardBuilder/catalog.ts +61 -57
  219. package/src/components/DashboardBuilder/changedTile.spec.ts +46 -0
  220. package/src/components/DashboardBuilder/changedTile.ts +28 -0
  221. package/src/components/DashboardBuilder/chartLine.spec.ts +180 -0
  222. package/src/components/DashboardBuilder/chartLine.ts +121 -0
  223. package/src/components/DashboardBuilder/controls.spec.ts +21 -10
  224. package/src/components/DashboardBuilder/controls.ts +22 -8
  225. package/src/components/DashboardBuilder/document.ts +53 -5
  226. package/src/components/DashboardBuilder/documentSession.spec.ts +209 -0
  227. package/src/components/DashboardBuilder/documentSession.ts +258 -0
  228. package/src/components/DashboardBuilder/emptyStart.spec.ts +131 -0
  229. package/src/components/DashboardBuilder/imports.spec.ts +61 -0
  230. package/src/components/DashboardBuilder/imports.ts +93 -0
  231. package/src/components/DashboardBuilder/inlineEdit.tsx +78 -0
  232. package/src/components/DashboardBuilder/invariants.spec.ts +6 -2
  233. package/src/components/DashboardBuilder/legacyNotebook.chart.spec.ts +77 -0
  234. package/src/components/DashboardBuilder/legacyNotebook.convert.spec.ts +630 -0
  235. package/src/components/DashboardBuilder/legacyNotebook.read.spec.ts +338 -0
  236. package/src/components/DashboardBuilder/legacyNotebook.ts +1117 -0
  237. package/src/components/DashboardBuilder/loadMalloy.spec.ts +80 -0
  238. package/src/components/DashboardBuilder/loadMalloy.ts +39 -0
  239. package/src/components/DashboardBuilder/malloyTree.ts +159 -7
  240. package/src/components/DashboardBuilder/newDashboard.spec.ts +46 -2
  241. package/src/components/DashboardBuilder/newDashboard.ts +30 -3
  242. package/src/components/DashboardBuilder/openDraft.ts +52 -0
  243. package/src/components/DashboardBuilder/preview.shapes.spec.ts +75 -0
  244. package/src/components/DashboardBuilder/preview.spec.ts +159 -12
  245. package/src/components/DashboardBuilder/preview.ts +83 -9
  246. package/src/components/DashboardBuilder/readDocument.spec.ts +174 -26
  247. package/src/components/DashboardBuilder/readDocument.ts +137 -45
  248. package/src/components/DashboardBuilder/readForEditor.spec.ts +80 -0
  249. package/src/components/DashboardBuilder/readForEditor.ts +52 -0
  250. package/src/components/DashboardBuilder/scannerShapes.spec.ts +14 -13
  251. package/src/components/DashboardBuilder/sortable.spec.ts +89 -0
  252. package/src/components/DashboardBuilder/sortable.tsx +11 -10
  253. package/src/components/DashboardBuilder/spliceDocument.chart.spec.ts +340 -0
  254. package/src/components/DashboardBuilder/spliceDocument.imports.spec.ts +167 -0
  255. package/src/components/DashboardBuilder/spliceDocument.spec.ts +229 -94
  256. package/src/components/DashboardBuilder/spliceDocument.ts +768 -131
  257. package/src/components/DashboardBuilder/spliceResult.ts +15 -0
  258. package/src/components/DashboardBuilder/statementExtent.spec.ts +33 -30
  259. package/src/components/DashboardBuilder/tagParse.spec.ts +149 -0
  260. package/src/components/DashboardBuilder/tagParse.ts +103 -0
  261. package/src/components/DashboardBuilder/telemetry.ts +47 -0
  262. package/src/components/DashboardBuilder/testing/artifactTagParity.json +253 -0
  263. package/src/components/DashboardBuilder/testing/documentKindRule.json +40 -0
  264. package/src/components/DashboardBuilder/testing/fixtures.ts +16 -1
  265. package/src/components/DashboardBuilder/testing/inline.ts +25 -0
  266. package/src/components/DashboardBuilder/testing/resize.ts +48 -0
  267. package/src/components/DashboardBuilder/testing/urlRenderTags.json +62 -0
  268. package/src/components/DashboardBuilder/textTiles.spec.ts +760 -0
  269. package/src/components/DashboardBuilder/tileDisplayTitle.ts +13 -0
  270. package/src/components/DashboardBuilder/useBuilderSelection.ts +121 -0
  271. package/src/components/DashboardBuilder/useBuilderSession.spec.ts +250 -0
  272. package/src/components/DashboardBuilder/useBuilderSession.ts +255 -0
  273. package/src/components/DashboardBuilder/useBuilderShortcuts.overlay.spec.tsx +97 -0
  274. package/src/components/DashboardBuilder/useBuilderShortcuts.spec.tsx +60 -0
  275. package/src/components/DashboardBuilder/useBuilderShortcuts.ts +45 -9
  276. package/src/components/DashboardBuilder/useControlBindings.ts +152 -0
  277. package/src/components/DashboardBuilder/useConversionConfirm.ts +55 -0
  278. package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +16 -13
  279. package/src/components/DashboardBuilder/useDashboardEditor.ts +57 -181
  280. package/src/components/DashboardBuilder/useDocumentEditor.spec.ts +565 -0
  281. package/src/components/DashboardBuilder/useDocumentEditor.ts +399 -0
  282. package/src/components/DashboardBuilder/useDraft.ts +15 -2
  283. package/src/components/DashboardBuilder/useExitGuard.spec.ts +159 -0
  284. package/src/components/DashboardBuilder/useExitGuard.ts +89 -0
  285. package/src/components/DashboardBuilder/useFilterForm.existing.spec.tsx +41 -0
  286. package/src/components/DashboardBuilder/useFilterForm.spec.tsx +24 -2
  287. package/src/components/DashboardBuilder/useFilterForm.ts +41 -13
  288. package/src/components/DashboardBuilder/useHostCopy.ts +104 -0
  289. package/src/components/DashboardBuilder/useOpenDraftCommit.ts +47 -0
  290. package/src/components/DashboardBuilder/useOpenedDocument.ts +314 -0
  291. package/src/components/DashboardBuilder/useSaveChannel.ts +275 -0
  292. package/src/components/DashboardBuilder/useTileEditing.ts +141 -0
  293. package/src/components/DashboardBuilder/useTileReorder.spec.tsx +28 -5
  294. package/src/components/DashboardBuilder/useTileReorder.ts +5 -7
  295. package/src/components/DashboardBuilder/useTileResize.spec.tsx +30 -5
  296. package/src/components/DashboardBuilder/useTileResize.ts +31 -8
  297. package/src/components/DataAppViewer/DataAppViewer.tsx +7 -4
  298. package/src/components/DocumentCreate/canRetry.spec.ts +32 -0
  299. package/src/components/DocumentCreate/canRetry.ts +19 -0
  300. package/src/components/DocumentCreate/createDocument.spec.ts +310 -0
  301. package/src/components/DocumentCreate/createDocument.ts +159 -0
  302. package/src/components/DocumentCreate/documentPath.ts +40 -0
  303. package/src/components/DocumentCreate/events.ts +15 -0
  304. package/src/components/DocumentCreate/exportedSources.ts +25 -0
  305. package/src/components/DocumentCreate/guards.ts +45 -0
  306. package/src/components/DocumentCreate/index.ts +27 -0
  307. package/src/components/DocumentCreate/newNotebook.spec.ts +156 -0
  308. package/src/components/DocumentCreate/newNotebook.ts +44 -0
  309. package/src/components/DocumentCreate/useDocumentChoices.spec.tsx +138 -0
  310. package/src/components/DocumentCreate/useDocumentChoices.ts +113 -0
  311. package/src/components/DocumentStorage/DocumentStorage.ts +2 -1
  312. package/src/components/Environment/Environment.tsx +0 -10
  313. package/src/components/Loading.tsx +14 -0
  314. package/src/components/Model/Model.tsx +16 -9
  315. package/src/components/Model/ModelExplorer.spec.tsx +2 -2
  316. package/src/components/Model/ModelExplorer.tsx +2 -2
  317. package/src/components/Model/SourcesExplorer.tsx +2 -4
  318. package/src/components/NarrowEditGate.spec.tsx +73 -0
  319. package/src/components/NarrowEditGate.tsx +29 -0
  320. package/src/components/Notebook/Notebook.layout.spec.tsx +94 -0
  321. package/src/components/Notebook/Notebook.tsx +72 -29
  322. package/src/components/Notebook/NotebookCell.tsx +90 -215
  323. package/src/components/Package/NewDocumentDialog.spec.tsx +749 -0
  324. package/src/components/Package/NewDocumentDialog.tsx +401 -0
  325. package/src/components/Package/Package.artifacts.spec.tsx +186 -0
  326. package/src/components/Package/Package.create.spec.tsx +401 -0
  327. package/src/components/Package/Package.notebooks.spec.tsx +18 -0
  328. package/src/components/Package/Package.tsx +396 -177
  329. package/src/components/Package/documentLocation.spec.ts +81 -0
  330. package/src/components/Package/documentLocation.ts +55 -0
  331. package/src/components/Package/index.ts +14 -1
  332. package/src/components/Package/useDocumentLocation.ts +59 -0
  333. package/src/components/PackageSection.tsx +2 -2
  334. package/src/components/Prose.spec.tsx +37 -0
  335. package/src/components/Prose.tsx +35 -5
  336. package/src/components/RenderedResult/RenderedResult.tsx +23 -8
  337. package/src/components/RenderedResult/ResultContainer.tsx +51 -13
  338. package/src/components/RenderedResult/ResultPanel.tsx +24 -5
  339. package/src/components/RenderedResult/loadRenderer.ts +42 -0
  340. package/src/components/RenderedResult/resultSizing.spec.ts +68 -0
  341. package/src/components/RenderedResult/resultSizing.ts +14 -3
  342. package/src/components/ServerProvider.tsx +2 -1
  343. package/src/components/UnsavedChangesDialog.spec.tsx +70 -0
  344. package/src/components/UnsavedChangesDialog.tsx +49 -0
  345. package/src/components/given/GivenInput.spec.tsx +5 -5
  346. package/src/components/given/GivenInput.tsx +46 -38
  347. package/src/components/given/GivensPanel.spec.tsx +6 -6
  348. package/src/components/given/GivensPanel.tsx +5 -11
  349. package/src/components/given/paramCodec.ts +27 -1
  350. package/src/components/index.ts +3 -2
  351. package/src/components/styles.ts +4 -5
  352. package/src/hooks/givenValue.ts +9 -0
  353. package/src/hooks/index.ts +7 -0
  354. package/src/hooks/useCompiledDocument.spec.tsx +86 -0
  355. package/src/hooks/useCompiledDocument.ts +59 -0
  356. package/src/hooks/useDimensionalFilterRangeData.ts +3 -1
  357. package/src/hooks/useDocumentControls.ts +13 -1
  358. package/src/hooks/useNarrowScreen.ts +21 -0
  359. package/src/hooks/useNearViewport.spec.tsx +150 -0
  360. package/src/hooks/useNearViewport.ts +102 -0
  361. package/src/hooks/useQueryResult.ts +23 -1
  362. package/src/hooks/useQueryWithApiError.ts +10 -3
  363. package/src/hooks/useRawQueryData.ts +3 -1
  364. package/src/hooks/useSettled.spec.ts +41 -0
  365. package/src/hooks/useSettled.ts +27 -0
  366. package/src/hooks/useSuggestOptions.dom.spec.ts +40 -1
  367. package/src/hooks/useSuggestOptions.ts +42 -10
  368. package/src/mainEntry.spec.ts +145 -0
  369. package/src/text-entry.ts +12 -0
  370. package/src/textEntry.spec.ts +112 -0
  371. package/src/theme/accent.spec.ts +116 -0
  372. package/src/theme/accent.ts +148 -0
  373. package/src/theme/buildTableCssVars.spec.ts +24 -0
  374. package/src/theme/buildTableCssVars.ts +1 -2
  375. package/src/theme/buildVegaThemeOverride.spec.ts +38 -2
  376. package/src/theme/buildVegaThemeOverride.ts +5 -5
  377. package/src/theme/defaults.ts +34 -0
  378. package/src/theme/index.ts +9 -0
  379. package/src/theme/keys.ts +6 -0
  380. package/src/theme/motion.ts +44 -0
  381. package/src/theme/readChartAnnotations.spec.ts +18 -0
  382. package/src/theme/readChartAnnotations.ts +1 -1
  383. package/src/theme/resolveTheme.spec.ts +73 -0
  384. package/src/theme/resolveTheme.ts +61 -20
  385. package/src/theme/types.ts +30 -5
  386. package/src/utils/clock.spec.ts +12 -0
  387. package/src/utils/clock.ts +6 -0
  388. package/src/{components/DashboardBuilder → utils}/malloyText.spec.ts +48 -0
  389. package/src/utils/malloyText.ts +368 -0
  390. package/src/utils/queryClient.ts +8 -0
  391. package/vite.config.ts +4 -0
  392. package/dist/Dashboard-ChyylkTD.cjs.js +0 -136
  393. package/dist/RenderedResult-AJPMUkAD.cjs.js +0 -135
  394. package/dist/ServerProvider-CXrOKD6g.cjs.js +0 -1
  395. package/dist/components/Dashboard/DashboardBar.d.ts +0 -21
  396. package/dist/components/Dashboard/ExploreDialog.d.ts +0 -20
  397. package/dist/components/DashboardBuilder/DiffDialog.d.ts +0 -15
  398. package/dist/components/DashboardBuilder/SettingsPopover.d.ts +0 -20
  399. package/dist/components/DashboardBuilder/diff.d.ts +0 -35
  400. package/dist/components/DashboardBuilder/malloyText.d.ts +0 -64
  401. package/dist/components/Package/NewDashboardDialog.d.ts +0 -18
  402. package/src/components/Dashboard/DashboardBar.tsx +0 -88
  403. package/src/components/Dashboard/ExploreDialog.tsx +0 -89
  404. package/src/components/DashboardBuilder/DiffDialog.tsx +0 -122
  405. package/src/components/DashboardBuilder/SettingsPopover.tsx +0 -168
  406. package/src/components/DashboardBuilder/diff.spec.ts +0 -44
  407. package/src/components/DashboardBuilder/diff.ts +0 -93
  408. package/src/components/DashboardBuilder/malloyText.ts +0 -214
  409. package/src/components/Package/NewDashboardDialog.spec.tsx +0 -129
  410. package/src/components/Package/NewDashboardDialog.tsx +0 -265
@@ -1,88 +1,88 @@
1
- import { jsx as I } from "react/jsx-runtime";
2
- import { Box as oe, useTheme as ce } from "@mui/material";
3
- import { Suspense as ue, useRef as z, useCallback as he, useMemo as me, useEffect as be, useLayoutEffect as fe } from "react";
4
- import { D as ye, r as K, b as pe, a as ge, m as ve, c as we, d as ae } from "./Dashboard-H1kJlDFo.es.js";
5
- import { aG as ke, aH as Ce, aI as xe } from "./ServerProvider-Boxrv6Ym.es.js";
1
+ import { jsx as L } from "react/jsx-runtime";
2
+ import { Box as ne, useTheme as he } from "@mui/material";
3
+ import { Suspense as me, useRef as z, useCallback as be, useMemo as fe, useEffect as ye, useLayoutEffect as pe } from "react";
4
+ import { D as ge, r as U, l as ve, a as we, b as ke, c as xe, m as Ce, d as Re, e as le } from "./useCompiledDocument-BU6d8FPp.es.js";
5
+ import { aM as Ee, aK as Se, aN as Ae } from "./ServerProvider-CcSrGaRN.es.js";
6
6
  const g = "publisher-drill";
7
- function Re(e, r) {
7
+ function Te(e, r) {
8
8
  const t = /* @__PURE__ */ new Set();
9
- let a;
9
+ let l;
10
10
  try {
11
- a = e.getMetadata()?.getAllFields() ?? [];
11
+ l = e.getMetadata()?.getAllFields() ?? [];
12
12
  } catch {
13
13
  return t;
14
14
  }
15
- const n = /* @__PURE__ */ new Set();
16
- for (const o of a)
17
- !o || r(o) || o.tag?.tag("hidden") === void 0 && n.add(o.tag?.text("label") ?? o.name);
18
- for (const o of a) {
19
- if (!o || !r(o)) continue;
20
- const l = o.tag?.text("label") ?? o.name;
21
- n.has(l) || t.add(l);
15
+ const o = /* @__PURE__ */ new Set();
16
+ for (const a of l)
17
+ !a || r(a) || a.tag?.tag("hidden") === void 0 && o.add(a.tag?.text("label") ?? a.name);
18
+ for (const a of l) {
19
+ if (!a || !r(a)) continue;
20
+ const n = a.tag?.text("label") ?? a.name;
21
+ o.has(n) || t.add(n);
22
22
  }
23
23
  return t;
24
24
  }
25
- function L(e) {
25
+ function I(e) {
26
26
  const r = /^\s*(\d+)/.exec(e.style?.gridColumn ?? "");
27
27
  return r ? r[1] : void 0;
28
28
  }
29
- function Ee(e, r) {
29
+ function De(e, r) {
30
30
  if (r.size !== 0)
31
31
  for (const t of e.querySelectorAll(
32
32
  ".malloy-table"
33
33
  )) {
34
- const a = (l) => l.closest(".malloy-table") === t, n = /* @__PURE__ */ new Set();
35
- for (const l of t.querySelectorAll(
34
+ const l = (n) => n.closest(".malloy-table") === t, o = /* @__PURE__ */ new Set();
35
+ for (const n of t.querySelectorAll(
36
36
  ".column-cell.th"
37
37
  )) {
38
- if (!a(l)) continue;
39
- const s = (l.textContent ?? "").replace(/\u200b/g, "").trim(), y = L(l);
40
- y && r.has(s) && n.add(y);
38
+ if (!l(n)) continue;
39
+ const s = (n.textContent ?? "").replace(/\u200b/g, "").trim(), b = I(n);
40
+ b && r.has(s) && o.add(b);
41
41
  }
42
- if (n.size === 0) continue;
43
- const o = /* @__PURE__ */ new Set();
44
- for (const l of t.querySelectorAll(
42
+ if (o.size === 0) continue;
43
+ const a = /* @__PURE__ */ new Set();
44
+ for (const n of t.querySelectorAll(
45
45
  `.${g}[tabindex="0"]`
46
46
  )) {
47
- if (!a(l)) continue;
48
- const s = L(l);
49
- s && (o.has(s) ? l.tabIndex = -1 : o.add(s));
47
+ if (!l(n)) continue;
48
+ const s = I(n);
49
+ s && (a.has(s) ? n.tabIndex = -1 : a.add(s));
50
50
  }
51
- for (const l of t.querySelectorAll(
51
+ for (const n of t.querySelectorAll(
52
52
  ".column-cell.td"
53
53
  )) {
54
- if (!a(l)) continue;
55
- const s = L(l), y = !l.querySelector(".value-null") && (l.textContent ?? "").trim() !== "";
56
- if (s && y && n.has(s) && !l.querySelector(".malloy-table")) {
57
- if (l.classList.add(g), l.tabIndex === 0)
58
- o.add(s);
54
+ if (!l(n)) continue;
55
+ const s = I(n), b = !n.querySelector(".value-null") && (n.textContent ?? "").trim() !== "";
56
+ if (s && b && o.has(s) && !n.querySelector(".malloy-table")) {
57
+ if (n.classList.add(g), n.tabIndex === 0)
58
+ a.add(s);
59
59
  else {
60
- const h = o.has(s);
61
- h || o.add(s), l.tabIndex = h ? -1 : 0;
60
+ const y = a.has(s);
61
+ y || a.add(s), n.tabIndex = y ? -1 : 0;
62
62
  }
63
- l.setAttribute("role", "button");
63
+ n.setAttribute("role", "button");
64
64
  }
65
65
  }
66
66
  }
67
67
  }
68
- function Se(e) {
69
- const r = e.closest(".malloy-table"), t = L(e);
68
+ function Oe(e) {
69
+ const r = e.closest(".malloy-table"), t = I(e);
70
70
  return !r || !t ? [] : Array.from(
71
71
  r.querySelectorAll(`.${g}`)
72
72
  ).filter(
73
- (a) => a.closest(".malloy-table") === r && L(a) === t
73
+ (l) => l.closest(".malloy-table") === r && I(l) === t
74
74
  );
75
75
  }
76
- function ne(e, r) {
77
- const t = Se(e), a = t.indexOf(e);
78
- if (a === -1) return;
79
- const n = r === "first" ? t[0] : r === "last" ? t[t.length - 1] : t[Math.min(Math.max(a + r, 0), t.length - 1)];
80
- if (n) {
81
- for (const o of t) o.tabIndex = o === n ? 0 : -1;
82
- return n;
76
+ function ie(e, r) {
77
+ const t = Oe(e), l = t.indexOf(e);
78
+ if (l === -1) return;
79
+ const o = r === "first" ? t[0] : r === "last" ? t[t.length - 1] : t[Math.min(Math.max(l + r, 0), t.length - 1)];
80
+ if (o) {
81
+ for (const a of t) a.tabIndex = a === o ? 0 : -1;
82
+ return o;
83
83
  }
84
84
  }
85
- function Ae(e) {
85
+ function _e(e) {
86
86
  return {
87
87
  background: e.dashboardRoot,
88
88
  tableBackground: e.tableBackground,
@@ -104,106 +104,105 @@ function Ae(e) {
104
104
  mapColor: e.mapColor
105
105
  };
106
106
  }
107
- function De(e) {
108
- const { foreground: r, axisFaint: t, font: a } = e, n = {
107
+ function Fe(e) {
108
+ const { foreground: r, axisFaint: t, gridline: l, font: o } = e, a = {
109
109
  background: e.background,
110
- font: a.family,
111
- title: { color: r, font: a.family },
110
+ font: o.family,
111
+ title: { color: r, font: o.family },
112
112
  axis: {
113
113
  labelColor: r,
114
114
  titleColor: r,
115
115
  domainColor: t,
116
116
  tickColor: t,
117
- gridColor: t,
118
- labelFont: a.family,
119
- titleFont: a.family
117
+ gridColor: l,
118
+ labelFont: o.family,
119
+ titleFont: o.family
120
120
  },
121
121
  legend: {
122
122
  labelColor: r,
123
123
  titleColor: r,
124
- labelFont: a.family,
125
- titleFont: a.family
124
+ labelFont: o.family,
125
+ titleFont: o.family
126
126
  },
127
127
  header: { labelColor: r, titleColor: r },
128
128
  range: { category: e.series }
129
129
  };
130
- return (o) => n;
130
+ return (n) => a;
131
131
  }
132
- function Oe(e) {
132
+ function ze(e) {
133
133
  if (!e) return;
134
134
  const r = e.tag("theme");
135
135
  if (!r) return;
136
- const t = {}, a = r.tag("palette");
137
- if (a) {
138
- const o = {}, l = a.textArray("series");
139
- l && l.length > 0 && (o.series = l);
140
- for (const s of ke) {
141
- const y = a.tag(s);
142
- if (!y) continue;
143
- const h = {}, v = y.text("light"), x = y.text("dark");
144
- v && (h.light = v), x && (h.dark = x), Object.keys(h).length > 0 && (o[s] = h);
136
+ const t = {}, l = r.tag("palette");
137
+ if (l) {
138
+ const a = {}, n = l.textArray("series");
139
+ n && n.length > 0 && (a.series = n);
140
+ for (const s of Ee) {
141
+ const b = l.tag(s);
142
+ if (!b) continue;
143
+ const y = {}, k = b.text("light"), v = b.text("dark");
144
+ k && (y.light = k), v && (y.dark = v), Object.keys(y).length > 0 && (a[s] = y);
145
145
  }
146
- Object.keys(o).length > 0 && (t.palette = o);
146
+ Object.keys(a).length > 0 && (t.palette = a);
147
147
  }
148
- const n = r.tag("font");
149
- if (n) {
150
- const o = {}, l = n.text("family");
151
- l && (o.family = l);
152
- const s = n.numeric("size");
153
- typeof s == "number" && Number.isFinite(s) && (o.size = s), Object.keys(o).length > 0 && (t.font = o);
148
+ const o = r.tag("font");
149
+ if (o) {
150
+ const a = {}, n = o.text("family");
151
+ n && (a.family = n);
152
+ const s = o.numeric("size");
153
+ typeof s == "number" && Number.isFinite(s) && (a.size = s), Object.keys(a).length > 0 && (t.font = a);
154
154
  }
155
155
  return Object.keys(t).length > 0 ? t : void 0;
156
156
  }
157
- const Te = async (e, r) => {
157
+ const M = "data-publisher-fill", Le = async (e, r) => {
158
158
  if (typeof window > "u")
159
159
  throw new Error("MalloyRenderer can only be used in browser environment");
160
- const { MalloyRenderer: t } = await import("@malloydata/render");
160
+ const { MalloyRenderer: t } = await we();
161
161
  return new t({
162
162
  onClick: r,
163
- vegaConfigOverride: De(e),
163
+ vegaConfigOverride: Fe(e),
164
164
  // Pass the explicit theme so table chrome and dashboard tiles
165
165
  // pick up the operator's colours directly. Without this the
166
166
  // renderer's own inline style writes `--malloy-render--*` values
167
167
  // sourced from its built-in defaults and shadows whatever we set
168
168
  // on the outer wrapper.
169
- theme: Ae(e),
170
- onError: (n) => {
171
- console.error("Error rendering visualization:", typeof n, n);
169
+ theme: _e(e),
170
+ onError: (o) => {
171
+ console.error("Error rendering visualization:", typeof o, o);
172
172
  }
173
173
  }).createViz();
174
174
  };
175
- typeof window < "u" && import("@malloydata/render");
176
- async function _e(e) {
175
+ async function Me(e) {
177
176
  if (!e || typeof e != "object") return;
178
177
  const r = e, t = [
179
178
  ...Array.isArray(r.model_annotations) ? r.model_annotations : [],
180
179
  ...Array.isArray(r.source_annotations) ? r.source_annotations : [],
181
180
  ...Array.isArray(r.annotations) ? r.annotations : []
182
- ].map((n) => typeof n?.value == "string" ? n.value : void 0).filter((n) => !!n);
181
+ ].map((o) => typeof o?.value == "string" ? o.value : void 0).filter((o) => !!o);
183
182
  if (t.length === 0) return;
184
- let a;
183
+ let l;
185
184
  try {
186
- ({ parseAnnotation: a } = await import("@malloydata/malloy-tag"));
185
+ ({ parseAnnotation: l } = await ve());
187
186
  } catch {
188
187
  return;
189
188
  }
190
189
  try {
191
- const { tag: n } = a(t);
192
- return Oe(n);
193
- } catch (n) {
190
+ const { tag: o } = l(t);
191
+ return ze(o);
192
+ } catch (o) {
194
193
  console.warn(
195
194
  "Failed to parse # theme.* annotations; chart will render with the shell theme.",
196
- { error: n, lines: t }
195
+ { error: o, lines: t }
197
196
  );
198
197
  return;
199
198
  }
200
199
  }
201
- function Fe(e, r, t) {
202
- const a = pe(r, t);
203
- for (const [n, o] of Object.entries(a))
204
- e.style.setProperty(n, o);
200
+ function Ie(e, r, t) {
201
+ const l = ke(r, t);
202
+ for (const [o, a] of Object.entries(l))
203
+ e.style.setProperty(o, a);
205
204
  }
206
- const ze = `
205
+ const Be = `
207
206
  /* Card geometry, through the renderer's OWN theme vars rather than over the top
208
207
  of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
209
208
  passes each through to the --malloy-render--* the card CSS reads, so a value
@@ -288,6 +287,12 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
288
287
  .malloy-render .malloy-dashboard .dashboard-row-header-separator {
289
288
  background: var(--malloy-render--table-border) !important;
290
289
  }
290
+ /* !important because the malloy-explorer stylesheet pins these same properties with it. */
291
+ [${M}] .malloy-table.root {
292
+ height: 100% !important;
293
+ align-content: start !important;
294
+ grid-template-columns: repeat(var(--total-header-size), minmax(max-content, 1fr)) !important;
295
+ }
291
296
  .malloy-render .malloy-table .th.column-cell {
292
297
  /* Non-pinned tables have no header background in the renderer's
293
298
  own CSS (only pinned scrolled tables paint the pinned-header
@@ -337,56 +342,59 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
337
342
  color: var(--publisher-drill-link) !important;
338
343
  text-decoration: underline;
339
344
  }
340
- `, le = "publisher-malloy-renderer-overrides";
341
- function Ie() {
342
- if (typeof document > "u" || document.getElementById(le)) return;
345
+ `, se = "publisher-malloy-renderer-overrides";
346
+ function Ne() {
347
+ if (typeof document > "u" || document.getElementById(se)) return;
343
348
  const e = document.createElement("style");
344
- e.id = le, e.textContent = ze, document.head.appendChild(e);
349
+ e.id = se, e.textContent = Be, document.head.appendChild(e);
345
350
  }
346
- function Le({
351
+ function $e({
347
352
  result: e,
348
353
  height: r,
349
354
  drill: t,
350
- onSizeChange: a,
351
- onSizing: n
355
+ onSizeChange: l,
356
+ onSizing: o,
357
+ fill: a
352
358
  }) {
353
- const o = z(null), l = z(t);
354
- l.current = t;
355
- const s = he((c) => {
356
- l.current?.onClick(c);
357
- }, []), y = t !== void 0, h = z(!1), v = z(
359
+ const n = z(null), s = z(t);
360
+ s.current = t;
361
+ const b = be((c) => {
362
+ s.current?.onClick(c);
363
+ }, []), y = t !== void 0, k = z(!1), v = z(
358
364
  null
359
- ), x = z(0), { theme: G, layers: U, mode: X } = Ce(), Y = ce().shape.borderRadius, J = me(
365
+ ), P = z(0), { theme: X, layers: Y, mode: J } = Se(), W = he().shape.borderRadius, Q = fe(
360
366
  () => ({
361
- radius: `${Y}px`,
362
- padding: `${ye}px`
367
+ radius: `${W}px`,
368
+ padding: `${ge}px`
363
369
  }),
364
- [Y]
370
+ [W]
365
371
  );
366
- return be(() => () => {
367
- x.current += 1;
372
+ return ye(() => () => {
373
+ P.current += 1;
368
374
  const c = v.current;
369
375
  c?.viz.remove(), c?.node.remove(), v.current = null;
370
- }, []), fe(() => {
371
- if (!o.current || !e) return;
372
- Ie();
373
- const c = o.current, ie = x.current += 1;
374
- let j = !1;
375
- const P = () => !j && ie === x.current;
376
- let d, m, B = null, V = 0, M = null, N = null, $ = null, O = null, T = null, _ = null, W = null, Q = 0, R = null;
377
- h.current = !1;
378
- let p, E;
379
- const H = (w) => {
380
- if (j || !w.firstElementChild || K(p, E) === "container") return;
381
- const F = ge(p, E);
382
- if (h.current && !F) return;
383
- const k = ve(
376
+ }, []), pe(() => {
377
+ if (!n.current || !e) return;
378
+ Ne();
379
+ const c = n.current, de = P.current += 1;
380
+ let V = !1;
381
+ const q = () => !V && de === P.current;
382
+ let d, h, B = null, H = 0, N = null, $ = null, j = null, T = null, D = null, O = null, Z = null, ee = 0, C = null;
383
+ k.current = !1;
384
+ let p, R;
385
+ const K = (w) => {
386
+ if (V || !w.firstElementChild || U(p, R) === "container") return;
387
+ const _ = xe(p, R);
388
+ if (k.current && !_) return;
389
+ const F = c.hasAttribute(M);
390
+ F && c.removeAttribute(M);
391
+ const E = Ce(
384
392
  w,
385
- ae(p)
393
+ le(p)
386
394
  );
387
- k > 0 && (h.current = !0, a && k !== Q && (Q = k, a(k)));
388
- const S = we(w, ae(p));
389
- F && S && W !== S && (W = S, _?.disconnect(), _ = new ResizeObserver(() => H(w)), _.observe(S));
395
+ F && c.setAttribute(M, ""), E > 0 && (k.current = !0, l && E !== ee && (ee = E, l(E)));
396
+ const u = Re(w, le(p));
397
+ _ && u && Z !== u && (Z = u, O?.disconnect(), O = new ResizeObserver(() => K(w)), O.observe(u));
390
398
  };
391
399
  return (async () => {
392
400
  let w;
@@ -396,121 +404,122 @@ function Le({
396
404
  console.error("Error parsing visualization result:", f);
397
405
  return;
398
406
  }
399
- const F = await _e(w), k = F ? xe([...U, F], X) : G;
400
- if (!P()) return;
407
+ const _ = await Me(w), F = _ ? Ae([...Y, _], J) : X;
408
+ if (!q()) return;
401
409
  try {
402
- m = await Te(k, s);
410
+ h = await Le(F, b);
403
411
  } catch (f) {
404
412
  console.error("Failed to create renderer:", f);
405
413
  return;
406
414
  }
407
- if (!P()) {
408
- m.remove(), m = void 0;
415
+ if (!q()) {
416
+ h.remove(), h = void 0;
409
417
  return;
410
418
  }
411
- const S = v.current;
412
- d = document.createElement("div"), d.style.width = "100%", d.style.height = "100%", Fe(d, k, J), c.childElementCount > 0 && (c.style.position = "relative", d.style.position = "absolute", d.style.inset = "0", d.style.visibility = "hidden"), c.appendChild(d);
419
+ const E = v.current;
420
+ d = document.createElement("div"), d.style.width = "100%", d.style.height = "100%", Ie(d, F, Q), c.childElementCount > 0 && (c.style.position = "relative", d.style.position = "absolute", d.style.inset = "0", d.style.visibility = "hidden"), c.appendChild(d);
413
421
  const u = d;
414
- O = new MutationObserver(() => {
415
- T && clearTimeout(T), T = setTimeout(() => {
416
- H(u), h.current && O?.disconnect();
422
+ T = new MutationObserver(() => {
423
+ D && clearTimeout(D), D = setTimeout(() => {
424
+ K(u), k.current && T?.disconnect();
417
425
  }, 100);
418
- }), O.observe(d, {
426
+ }), T.observe(d, {
419
427
  childList: !0,
420
428
  subtree: !0,
421
429
  attributes: !0
422
430
  });
423
- const se = m;
424
- let Z = !1;
425
- const ee = () => {
426
- if (!(Z || !P())) {
427
- Z = !0, R && (clearTimeout(R), R = null), S?.viz.remove();
431
+ const ce = h;
432
+ let re = !1;
433
+ const te = () => {
434
+ if (!(re || !q())) {
435
+ re = !0, C && (clearTimeout(C), C = null), E?.viz.remove();
428
436
  for (const f of Array.from(c.children))
429
437
  f !== u && c.removeChild(f);
430
- u.style.position = "", u.style.inset = "", u.style.visibility = "", c.style.position = "", v.current = { viz: se, node: u }, H(u);
438
+ u.style.position = "", u.style.inset = "", u.style.visibility = "", c.style.position = "", v.current = { viz: ce, node: u }, K(u);
431
439
  }
432
440
  };
433
441
  try {
434
- m.setResult(w);
442
+ h.setResult(w);
435
443
  try {
436
- const C = m.getMetadata(), A = C?.getRootField();
437
- p = A?.renderAs(), E = A ? C?.getPluginsForField(A.key)?.[0]?.sizingStrategy : void 0;
444
+ const x = h.getMetadata(), S = x?.getRootField();
445
+ p = S?.renderAs(), R = S ? x?.getPluginsForField(S.key)?.[0]?.sizingStrategy : void 0;
438
446
  } catch {
439
- p = void 0, E = void 0;
447
+ p = void 0, R = void 0;
440
448
  }
441
- n?.(K(p, E)), d.dataset.malloyRenderAs = p ?? "unknown", d.dataset.malloySizing = K(p, E), m.render(d);
442
- const f = l.current;
449
+ o?.(U(p, R)), d.dataset.malloyRenderAs = p ?? "unknown", d.dataset.malloySizing = U(p, R), h.render(d);
450
+ const f = s.current;
443
451
  try {
444
452
  if (f) {
445
- const C = Re(m, f.canDrill), A = () => {
453
+ const x = Te(h, f.canDrill), S = () => {
446
454
  try {
447
- Ee(u, C);
455
+ De(u, x);
448
456
  } catch (i) {
449
457
  console.warn("Drill affordance skipped:", i);
450
458
  }
451
459
  };
452
- A();
453
- const re = (i) => {
454
- const D = i.querySelector(".cell-content") ?? i, q = D.getBoundingClientRect();
455
- D.dispatchEvent(
460
+ S();
461
+ const oe = (i) => {
462
+ const A = i.querySelector(".cell-content") ?? i, G = A.getBoundingClientRect();
463
+ A.dispatchEvent(
456
464
  new MouseEvent("click", {
457
465
  bubbles: !0,
458
466
  cancelable: !0,
459
- view: D.ownerDocument.defaultView,
460
- clientX: Math.round(q.left + q.width / 2),
461
- clientY: Math.round(q.bottom)
467
+ view: A.ownerDocument.defaultView,
468
+ clientX: Math.round(G.left + G.width / 2),
469
+ clientY: Math.round(G.bottom)
462
470
  })
463
471
  );
464
- }, te = (i) => i.target?.closest?.(`.${g}`) ?? null, de = (i, b) => {
465
- ne(i, b)?.focus();
472
+ }, ae = (i) => i.target?.closest?.(`.${g}`) ?? null, ue = (i, m) => {
473
+ ie(i, m)?.focus();
466
474
  };
467
- M = (i) => {
468
- const b = te(i);
469
- if (!b) return;
470
- const D = i.key === "ArrowDown" ? 1 : i.key === "ArrowUp" ? -1 : i.key === "Home" ? "first" : i.key === "End" ? "last" : void 0;
471
- if (D !== void 0) {
472
- i.preventDefault(), de(b, D);
475
+ N = (i) => {
476
+ const m = ae(i);
477
+ if (!m) return;
478
+ const A = i.key === "ArrowDown" ? 1 : i.key === "ArrowUp" ? -1 : i.key === "Home" ? "first" : i.key === "End" ? "last" : void 0;
479
+ if (A !== void 0) {
480
+ i.preventDefault(), ue(m, A);
473
481
  return;
474
482
  }
475
- i.key === "Enter" ? (i.preventDefault(), re(b)) : i.key === " " && i.preventDefault();
476
- }, N = (i) => {
477
- if (i.key !== " ") return;
478
- const b = te(i);
479
- b && (i.preventDefault(), re(b));
483
+ i.key === "Enter" ? (i.preventDefault(), oe(m)) : i.key === " " && i.preventDefault();
480
484
  }, $ = (i) => {
481
- const b = i.target?.closest?.(`.${g}`);
482
- b && ne(b, 0);
483
- }, u.addEventListener("keydown", M), u.addEventListener("keyup", N), u.addEventListener("focusin", $), C.size > 0 && typeof MutationObserver < "u" && (B = new MutationObserver(() => {
484
- cancelAnimationFrame(V), V = requestAnimationFrame(A);
485
+ if (i.key !== " ") return;
486
+ const m = ae(i);
487
+ m && (i.preventDefault(), oe(m));
488
+ }, j = (i) => {
489
+ const m = i.target?.closest?.(`.${g}`);
490
+ m && ie(m, 0);
491
+ }, u.addEventListener("keydown", N), u.addEventListener("keyup", $), u.addEventListener("focusin", j), x.size > 0 && typeof MutationObserver < "u" && (B = new MutationObserver(() => {
492
+ cancelAnimationFrame(H), H = requestAnimationFrame(S);
485
493
  }), B.observe(u, {
486
494
  childList: !0,
487
495
  subtree: !0
488
496
  }));
489
497
  }
490
- } catch (C) {
491
- console.warn("Drill affordance skipped:", C);
498
+ } catch (x) {
499
+ console.warn("Drill affordance skipped:", x);
492
500
  }
493
- m.onReady(ee), R = setTimeout(ee, 1e4);
501
+ h.onReady(te), C = setTimeout(te, 1e4);
494
502
  } catch (f) {
495
- console.error("Error rendering visualization:", f), O?.disconnect(), _?.disconnect(), B?.disconnect(), m.remove(), m = void 0, u.parentNode === c && c.removeChild(u);
503
+ console.error("Error rendering visualization:", f), T?.disconnect(), O?.disconnect(), B?.disconnect(), h.remove(), h = void 0, u.parentNode === c && c.removeChild(u);
496
504
  }
497
505
  })(), () => {
498
- j = !0, O?.disconnect(), _?.disconnect(), T && clearTimeout(T), R && clearTimeout(R), d && v.current?.node !== d && (M && d.removeEventListener("keydown", M), N && d.removeEventListener("keyup", N), $ && d.removeEventListener("focusin", $), B?.disconnect(), cancelAnimationFrame(V), m?.remove(), d.parentNode === c && c.removeChild(d), c.style.position = "");
506
+ V = !0, T?.disconnect(), O?.disconnect(), D && clearTimeout(D), C && clearTimeout(C), d && v.current?.node !== d && (N && d.removeEventListener("keydown", N), $ && d.removeEventListener("keyup", $), j && d.removeEventListener("focusin", j), B?.disconnect(), cancelAnimationFrame(H), h?.remove(), d.parentNode === c && c.removeChild(d), c.style.position = "");
499
507
  };
500
508
  }, [
501
509
  e,
502
- s,
510
+ b,
503
511
  y,
504
- a,
505
- n,
506
- G,
507
- U,
512
+ l,
513
+ o,
508
514
  X,
509
- J
510
- ]), /* @__PURE__ */ I(
515
+ Y,
516
+ J,
517
+ Q
518
+ ]), /* @__PURE__ */ L(
511
519
  "div",
512
520
  {
513
- ref: o,
521
+ ref: n,
522
+ ...a ? { [M]: "" } : {},
514
523
  style: {
515
524
  width: "100%",
516
525
  height: r ? `${r}px` : "400px"
@@ -518,9 +527,9 @@ function Le({
518
527
  }
519
528
  );
520
529
  }
521
- function Be(e) {
522
- return typeof window > "u" ? /* @__PURE__ */ I(
523
- oe,
530
+ function je(e) {
531
+ return typeof window > "u" ? /* @__PURE__ */ L(
532
+ ne,
524
533
  {
525
534
  sx: {
526
535
  width: "100%",
@@ -532,11 +541,11 @@ function Be(e) {
532
541
  },
533
542
  children: "Loading..."
534
543
  }
535
- ) : /* @__PURE__ */ I(
536
- ue,
544
+ ) : /* @__PURE__ */ L(
545
+ me,
537
546
  {
538
- fallback: /* @__PURE__ */ I(
539
- oe,
547
+ fallback: /* @__PURE__ */ L(
548
+ ne,
540
549
  {
541
550
  sx: {
542
551
  width: "100%",
@@ -549,21 +558,21 @@ function Be(e) {
549
558
  children: "Loading visualization..."
550
559
  }
551
560
  ),
552
- children: /* @__PURE__ */ I(Le, { ...e })
561
+ children: /* @__PURE__ */ L($e, { ...e })
553
562
  }
554
563
  );
555
564
  }
556
- const Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
565
+ const Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
557
566
  __proto__: null,
558
- default: Be
567
+ default: je
559
568
  }, Symbol.toStringTag, { value: "Module" }));
560
569
  export {
561
570
  g as D,
562
- Be as R,
563
- De as a,
564
- Ae as b,
565
- Ve as c,
566
- Re as d,
567
- Ee as m,
568
- Oe as r
571
+ je as R,
572
+ Fe as a,
573
+ _e as b,
574
+ Ge as c,
575
+ Te as d,
576
+ De as m,
577
+ ze as r
569
578
  };