@malloy-publisher/sdk 0.0.382-dev → 0.2.1

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 (284) hide show
  1. package/README.md +115 -95
  2. package/TREE_SHAKING.md +16 -11
  3. package/bunfig.toml +7 -0
  4. package/dist/ServerProvider-Cn_LhKda.cjs.js +1 -0
  5. package/dist/ServerProvider-sfabtriY.es.js +4076 -0
  6. package/dist/client/api.d.ts +3773 -1515
  7. package/dist/client/configuration.d.ts +1 -1
  8. package/dist/client/index.cjs.js +1 -1
  9. package/dist/client/index.d.ts +1 -1
  10. package/dist/client/index.es.js +86 -59
  11. package/dist/components/Connections/EditConnectionDialog.d.ts +2 -1
  12. package/dist/components/Connections/common.d.ts +8 -2
  13. package/dist/components/Dashboard/Dashboard.d.ts +62 -0
  14. package/dist/components/Dashboard/DashboardTile.d.ts +57 -0
  15. package/dist/components/Dashboard/index.d.ts +2 -0
  16. package/dist/components/DataAppViewer/DataAppViewer.d.ts +23 -0
  17. package/dist/components/DataAppViewer/index.d.ts +1 -0
  18. package/dist/components/Environment/Environment.d.ts +6 -0
  19. package/dist/components/Environment/index.d.ts +2 -0
  20. package/dist/components/Home/AddEnvironmentDialog.d.ts +1 -0
  21. package/dist/components/Home/DeleteEnvironmentDialog.d.ts +5 -0
  22. package/dist/components/Home/EditEnvironmentDialog.d.ts +7 -0
  23. package/dist/components/Home/Home.d.ts +2 -2
  24. package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +14 -0
  25. package/dist/components/Materializations/CreateMaterializationDialog.d.ts +10 -0
  26. package/dist/components/Materializations/DeleteMaterializationDialog.d.ts +7 -0
  27. package/dist/components/Materializations/EnvironmentMaterializations.d.ts +7 -0
  28. package/dist/components/Materializations/ManifestView.d.ts +13 -0
  29. package/dist/components/Materializations/MaterializationDetailDialog.d.ts +9 -0
  30. package/dist/components/Materializations/MaterializationRunsList.d.ts +15 -0
  31. package/dist/components/Materializations/Materializations.d.ts +7 -0
  32. package/dist/components/Materializations/ScheduleCard.d.ts +20 -0
  33. package/dist/components/Materializations/SectionLabel.d.ts +10 -0
  34. package/dist/components/Materializations/SetScheduleDialog.d.ts +11 -0
  35. package/dist/components/Materializations/TriggerChip.d.ts +10 -0
  36. package/dist/components/Materializations/cron.d.ts +23 -0
  37. package/dist/components/Materializations/index.d.ts +2 -0
  38. package/dist/components/Materializations/utils.d.ts +46 -0
  39. package/dist/components/Notebook/Notebook.d.ts +47 -4
  40. package/dist/components/Notebook/NotebookCell.d.ts +37 -1
  41. package/dist/components/Notebook/runPlan.d.ts +29 -0
  42. package/dist/components/Notebook/types.d.ts +10 -0
  43. package/dist/components/Package/ContentTypeIcon.d.ts +31 -0
  44. package/dist/components/Package/Package.d.ts +1 -4
  45. package/dist/components/RenderedResult/RenderedResult.d.ts +7 -1
  46. package/dist/components/RenderedResult/ResultContainer.d.ts +5 -1
  47. package/dist/components/RenderedResult/renderLogs.d.ts +6 -0
  48. package/dist/components/ResultsDialog.d.ts +6 -1
  49. package/dist/components/ServerProvider.d.ts +28 -4
  50. package/dist/components/click_helper.d.ts +10 -1
  51. package/dist/components/drill/index.d.ts +3 -0
  52. package/dist/components/drill/markDrillableCells.d.ts +55 -0
  53. package/dist/components/drill/resolveDrill.d.ts +139 -0
  54. package/dist/components/drill/useDrill.d.ts +63 -0
  55. package/dist/components/given/GivenInput.d.ts +52 -0
  56. package/dist/components/given/GivensPanel.d.ts +47 -0
  57. package/dist/components/given/filterValue.d.ts +97 -0
  58. package/dist/components/given/index.d.ts +2 -0
  59. package/dist/components/given/paramCodec.d.ts +60 -0
  60. package/dist/components/given/utils.d.ts +17 -0
  61. package/dist/components/highlighter.d.ts +6 -1
  62. package/dist/components/index.d.ts +7 -2
  63. package/dist/components/styles.d.ts +47 -0
  64. package/dist/constants/docLinks.d.ts +12 -0
  65. package/dist/{core-YNpOLuB1.cjs.js → core-CqRKhtoy.cjs.js} +1 -1
  66. package/dist/{core-CjeTkq8O.es.js → core-DyU47reh.es.js} +1 -1
  67. package/dist/github-dark-BKL9xNgN.cjs.js +1 -0
  68. package/dist/github-dark-DenFmJkN.es.js +4 -0
  69. package/dist/hooks/givenValue.d.ts +10 -0
  70. package/dist/hooks/index.d.ts +4 -0
  71. package/dist/hooks/useDimensionFiltersFromSpec.d.ts +3 -3
  72. package/dist/hooks/useDimensionFiltersQuery.d.ts +3 -3
  73. package/dist/hooks/useDimensionalFilterRangeData.d.ts +4 -4
  74. package/dist/hooks/useGivensState.d.ts +64 -0
  75. package/dist/hooks/useModelGivens.d.ts +10 -0
  76. package/dist/hooks/useSuggestOptions.d.ts +78 -0
  77. package/dist/{index-DRDu9kIV.es.js → index-CAkFE4Ol.es.js} +41278 -28504
  78. package/dist/index-DD4b_bt0.cjs.js +356 -0
  79. package/dist/index.cjs.js +1 -1
  80. package/dist/index.d.ts +4 -1
  81. package/dist/index.es.js +79 -48
  82. package/dist/malloy-explorer.css +12 -1
  83. package/dist/sdk.css +1 -1
  84. package/dist/theme/ThemeContext.d.ts +45 -0
  85. package/dist/theme/buildMalloyExplicitTheme.d.ts +34 -0
  86. package/dist/theme/buildTableCssVars.d.ts +41 -0
  87. package/dist/theme/buildVegaThemeOverride.d.ts +16 -0
  88. package/dist/theme/defaults.d.ts +7 -0
  89. package/dist/theme/index.d.ts +8 -0
  90. package/dist/theme/keys.d.ts +20 -0
  91. package/dist/theme/readChartAnnotations.d.ts +23 -0
  92. package/dist/theme/resolveTheme.d.ts +22 -0
  93. package/dist/theme/types.d.ts +70 -0
  94. package/dist/utils/dataAppEmbed.d.ts +44 -0
  95. package/dist/utils/formatting.d.ts +1 -1
  96. package/dist/utils/malloyString.d.ts +7 -0
  97. package/dist/utils/parsing.d.ts +2 -2
  98. package/dist/utils/queryClient.d.ts +5 -0
  99. package/package.json +19 -8
  100. package/src/client-entry.ts +3 -0
  101. package/src/components/AnalyzePackageButton.tsx +9 -3
  102. package/src/components/ApiErrorDisplay.tsx +3 -0
  103. package/src/components/Connections/AddConnectionDialog.tsx +132 -25
  104. package/src/components/Connections/DeleteConnectionDialog.tsx +14 -3
  105. package/src/components/Connections/EditConnectionDialog.tsx +167 -37
  106. package/src/components/Connections/common.ts +94 -3
  107. package/src/components/DOMElement/DOMElement.tsx +3 -0
  108. package/src/components/DOMElement/index.ts +3 -0
  109. package/src/components/Dashboard/Dashboard.spec.tsx +216 -0
  110. package/src/components/Dashboard/Dashboard.tsx +458 -0
  111. package/src/components/Dashboard/DashboardTile.spec.tsx +81 -0
  112. package/src/components/Dashboard/DashboardTile.tsx +199 -0
  113. package/src/components/Dashboard/index.ts +5 -0
  114. package/src/components/Dashboard/tileGridColumn.spec.ts +35 -0
  115. package/src/components/DataAppViewer/DataAppViewer.tsx +214 -0
  116. package/src/components/DataAppViewer/index.ts +4 -0
  117. package/src/components/{Project → Environment}/About.tsx +11 -4
  118. package/src/components/Environment/AddPackageDialog.tsx +202 -0
  119. package/src/components/{Project → Environment}/ConnectionExplorer.tsx +17 -14
  120. package/src/components/Environment/Connections.tsx +391 -0
  121. package/src/components/{Project → Environment}/DeletePackageDialog.tsx +8 -4
  122. package/src/components/{Project → Environment}/EditPackageDialog.tsx +21 -13
  123. package/src/components/Environment/Environment.tsx +89 -0
  124. package/src/components/Environment/Packages.tsx +206 -0
  125. package/src/components/Environment/index.ts +5 -0
  126. package/src/components/Home/{AddProjectDialog.tsx → AddEnvironmentDialog.tsx} +25 -19
  127. package/src/components/Home/{DeleteProjectDialog.tsx → DeleteEnvironmentDialog.tsx} +20 -15
  128. package/src/components/Home/{EditProjectDialog.tsx → EditEnvironmentDialog.tsx} +35 -28
  129. package/src/components/Home/Home.tsx +386 -408
  130. package/src/components/Home/index.ts +3 -0
  131. package/src/components/Loading.tsx +3 -0
  132. package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +179 -0
  133. package/src/components/Materializations/CreateMaterializationDialog.tsx +112 -0
  134. package/src/components/Materializations/DeleteMaterializationDialog.tsx +109 -0
  135. package/src/components/Materializations/EnvironmentMaterializations.tsx +267 -0
  136. package/src/components/Materializations/ManifestView.tsx +87 -0
  137. package/src/components/Materializations/MaterializationDetailDialog.tsx +259 -0
  138. package/src/components/Materializations/MaterializationRunsList.tsx +256 -0
  139. package/src/components/Materializations/Materializations.tsx +355 -0
  140. package/src/components/Materializations/ScheduleCard.tsx +231 -0
  141. package/src/components/Materializations/SectionLabel.tsx +30 -0
  142. package/src/components/Materializations/SetScheduleDialog.tsx +162 -0
  143. package/src/components/Materializations/TriggerChip.tsx +44 -0
  144. package/src/components/Materializations/cron.ts +124 -0
  145. package/src/components/Materializations/index.ts +5 -0
  146. package/src/components/Materializations/utils.ts +145 -0
  147. package/src/components/Model/Model.tsx +44 -2
  148. package/src/components/Model/ModelCell.tsx +14 -5
  149. package/src/components/Model/ModelExplorer.tsx +3 -0
  150. package/src/components/Model/ModelExplorerDialog.tsx +4 -1
  151. package/src/components/Model/SourcesExplorer.tsx +9 -6
  152. package/src/components/Model/index.ts +3 -0
  153. package/src/components/Model/useModelData.ts +6 -3
  154. package/src/components/Notebook/Notebook.spec.tsx +88 -0
  155. package/src/components/Notebook/Notebook.tsx +476 -339
  156. package/src/components/Notebook/NotebookCell.tsx +264 -25
  157. package/src/components/Notebook/index.ts +3 -0
  158. package/src/components/Notebook/runPlan.spec.ts +155 -0
  159. package/src/components/Notebook/runPlan.ts +67 -0
  160. package/src/components/Notebook/types.ts +14 -0
  161. package/src/components/Package/ContentTypeIcon.spec.ts +91 -0
  162. package/src/components/Package/ContentTypeIcon.tsx +177 -0
  163. package/src/components/Package/FileTreeView.tsx +3 -0
  164. package/src/components/Package/Models.tsx +7 -4
  165. package/src/components/Package/Package.spec.tsx +113 -0
  166. package/src/components/Package/Package.tsx +692 -59
  167. package/src/components/Package/index.ts +3 -0
  168. package/src/components/QueryResult/QueryResult.tsx +17 -8
  169. package/src/components/QueryResult/index.ts +3 -0
  170. package/src/components/RenderedResult/RenderedResult.tsx +725 -67
  171. package/src/components/RenderedResult/ResultContainer.tsx +71 -2
  172. package/src/components/RenderedResult/index.ts +3 -0
  173. package/src/components/RenderedResult/renderLogs.spec.ts +58 -0
  174. package/src/components/RenderedResult/renderLogs.ts +43 -0
  175. package/src/components/ResultsDialog.tsx +13 -1
  176. package/src/components/ServerProvider.tsx +175 -51
  177. package/src/components/Workbook/BrowserWorkbookStorage.ts +3 -0
  178. package/src/components/Workbook/EditableMalloyCell.tsx +3 -0
  179. package/src/components/Workbook/ModelPicker.tsx +7 -4
  180. package/src/components/Workbook/MutableCell.tsx +10 -5
  181. package/src/components/Workbook/Workbook.tsx +8 -5
  182. package/src/components/Workbook/WorkbookList.tsx +3 -0
  183. package/src/components/Workbook/WorkbookManager.ts +3 -0
  184. package/src/components/Workbook/WorkbookStorage.ts +3 -0
  185. package/src/components/Workbook/WorkbookStorageProvider.tsx +3 -0
  186. package/src/components/Workbook/index.ts +3 -0
  187. package/src/components/click_helper.ts +17 -1
  188. package/src/components/drill/index.ts +28 -0
  189. package/src/components/drill/markDrillableCells.dom.spec.ts +313 -0
  190. package/src/components/drill/markDrillableCells.spec.ts +109 -0
  191. package/src/components/drill/markDrillableCells.ts +314 -0
  192. package/src/components/drill/resolveDrill.spec.ts +449 -0
  193. package/src/components/drill/resolveDrill.ts +375 -0
  194. package/src/components/drill/useDrill.tsx +203 -0
  195. package/src/components/filter/DimensionFilter.tsx +3 -0
  196. package/src/components/filter/index.ts +3 -0
  197. package/src/components/filter/utils.ts +16 -5
  198. package/src/components/given/GivenInput.spec.tsx +689 -0
  199. package/src/components/given/GivenInput.tsx +801 -0
  200. package/src/components/given/GivensPanel.spec.tsx +175 -0
  201. package/src/components/given/GivensPanel.tsx +195 -0
  202. package/src/components/given/filterValue.spec.ts +364 -0
  203. package/src/components/given/filterValue.ts +207 -0
  204. package/src/components/given/index.ts +9 -0
  205. package/src/components/given/paramCodec.spec.ts +857 -0
  206. package/src/components/given/paramCodec.ts +483 -0
  207. package/src/components/given/utils.spec.ts +60 -0
  208. package/src/components/given/utils.ts +79 -0
  209. package/src/components/highlighter.ts +22 -5
  210. package/src/components/index.ts +10 -2
  211. package/src/components/styles.ts +82 -33
  212. package/src/constants/docLinks.spec.ts +54 -0
  213. package/src/constants/docLinks.ts +46 -0
  214. package/src/hooks/givenValue.ts +13 -0
  215. package/src/hooks/index.ts +13 -0
  216. package/src/hooks/useDimensionFilters.ts +4 -7
  217. package/src/hooks/useDimensionFiltersFromSpec.ts +8 -5
  218. package/src/hooks/useDimensionFiltersQuery.ts +10 -13
  219. package/src/hooks/useDimensionalFilterRangeData.ts +11 -14
  220. package/src/hooks/useGivensState.spec.ts +449 -0
  221. package/src/hooks/useGivensState.ts +340 -0
  222. package/src/hooks/useModelGivens.ts +29 -0
  223. package/src/hooks/useQueryWithApiError.ts +3 -0
  224. package/src/hooks/useRawQueryData.ts +6 -3
  225. package/src/hooks/useSuggestOptions.dom.spec.ts +91 -0
  226. package/src/hooks/useSuggestOptions.spec.ts +112 -0
  227. package/src/hooks/useSuggestOptions.ts +268 -0
  228. package/src/index.ts +10 -1
  229. package/src/react-app-env.d.ts +3 -0
  230. package/src/theme/ThemeContext.tsx +86 -0
  231. package/src/theme/buildMalloyExplicitTheme.ts +61 -0
  232. package/src/theme/buildTableCssVars.spec.ts +86 -0
  233. package/src/theme/buildTableCssVars.ts +98 -0
  234. package/src/theme/buildVegaThemeOverride.spec.ts +56 -0
  235. package/src/theme/buildVegaThemeOverride.ts +47 -0
  236. package/src/theme/defaults.ts +78 -0
  237. package/src/theme/index.ts +11 -0
  238. package/src/theme/keys.ts +32 -0
  239. package/src/theme/readChartAnnotations.spec.ts +58 -0
  240. package/src/theme/readChartAnnotations.ts +69 -0
  241. package/src/theme/resolveTheme.spec.ts +160 -0
  242. package/src/theme/resolveTheme.ts +121 -0
  243. package/src/theme/types.ts +79 -0
  244. package/src/utils/dataAppEmbed.spec.ts +63 -0
  245. package/src/utils/dataAppEmbed.ts +84 -0
  246. package/src/utils/formatting.spec.ts +25 -21
  247. package/src/utils/formatting.ts +11 -7
  248. package/src/utils/malloyString.spec.ts +24 -0
  249. package/src/utils/malloyString.ts +12 -0
  250. package/src/utils/parsing.spec.ts +26 -19
  251. package/src/utils/parsing.ts +11 -6
  252. package/src/utils/queryClient.ts +17 -0
  253. package/test/README.md +185 -0
  254. package/test/serverProvider.tsx +72 -0
  255. package/test/setup.ts +29 -0
  256. package/tsconfig.json +12 -1
  257. package/tsconfig.spec.json +22 -0
  258. package/vite.config.ts +3 -0
  259. package/dist/ServerProvider-lOQXDlqB.cjs.js +0 -1
  260. package/dist/ServerProvider-on-8FH5Z.es.js +0 -3060
  261. package/dist/components/Home/AddProjectDialog.d.ts +0 -1
  262. package/dist/components/Home/DeleteProjectDialog.d.ts +0 -5
  263. package/dist/components/Home/EditProjectDialog.d.ts +0 -7
  264. package/dist/components/Package/Config.d.ts +0 -5
  265. package/dist/components/Package/Databases.d.ts +0 -5
  266. package/dist/components/Package/Notebooks.d.ts +0 -6
  267. package/dist/components/Project/Project.d.ts +0 -6
  268. package/dist/components/Project/index.d.ts +0 -2
  269. package/dist/index-BOLBP6_i.cjs.js +0 -233
  270. package/src/components/Package/Config.tsx +0 -97
  271. package/src/components/Package/Connections.tsx +0 -373
  272. package/src/components/Package/Databases.tsx +0 -228
  273. package/src/components/Package/Notebooks.tsx +0 -77
  274. package/src/components/Project/AddPackageDialog.tsx +0 -159
  275. package/src/components/Project/Packages.tsx +0 -191
  276. package/src/components/Project/Project.tsx +0 -52
  277. package/src/components/Project/index.ts +0 -2
  278. /package/dist/components/{Project → Environment}/About.d.ts +0 -0
  279. /package/dist/components/{Project → Environment}/AddPackageDialog.d.ts +0 -0
  280. /package/dist/components/{Project → Environment}/ConnectionExplorer.d.ts +0 -0
  281. /package/dist/components/{Package → Environment}/Connections.d.ts +0 -0
  282. /package/dist/components/{Project → Environment}/DeletePackageDialog.d.ts +0 -0
  283. /package/dist/components/{Project → Environment}/EditPackageDialog.d.ts +0 -0
  284. /package/dist/components/{Project → Environment}/Packages.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ export { default as Materializations } from './Materializations';
2
+ export { default as EnvironmentMaterializations } from './EnvironmentMaterializations';
@@ -0,0 +1,46 @@
1
+ import { Materialization, MaterializationStatus } from '../../client';
2
+ /**
3
+ * Non-terminal phases of a build: PENDING (building) -> MANIFEST_ROWS_READY
4
+ * (tables built) -> MANIFEST_FILE_READY (terminal). Any non-terminal phase may
5
+ * be polled and stopped.
6
+ */
7
+ export declare function isActiveStatus(status?: MaterializationStatus): boolean;
8
+ export declare function isTerminalStatus(status?: MaterializationStatus): boolean;
9
+ /**
10
+ * Human-friendly status label. The publisher drives every phase automatically,
11
+ * so the intermediate states (PENDING / MANIFEST_ROWS_READY) both read as
12
+ * "Pending" and the terminal success state reads as "Done". Failures and
13
+ * cancellations keep their own labels.
14
+ */
15
+ export declare function statusLabel(status?: MaterializationStatus): string;
16
+ type ChipColor = "default" | "info" | "success" | "error" | "warning";
17
+ export declare function statusColor(status?: MaterializationStatus): ChipColor;
18
+ /**
19
+ * Shape of Materialization.metadata. The generated client types it as
20
+ * `object | null`, so callers must read it through parseMetadata(), which
21
+ * narrows defensively and tolerates a missing or differently-shaped object.
22
+ */
23
+ export interface MaterializationMetadata {
24
+ forceRefresh?: boolean;
25
+ sourceNames?: string[];
26
+ mode?: "auto" | "orchestrated";
27
+ /**
28
+ * What initiated the run. `SCHEDULER` = the standalone scheduler fired the
29
+ * package's `materialization.schedule` cron; `ON_DEMAND` (default) = an
30
+ * explicit API/UI create. Recorded on the run so a scheduled rebuild is
31
+ * distinguishable from a manual one.
32
+ */
33
+ trigger?: "ON_DEMAND" | "SCHEDULER";
34
+ sourcesBuilt?: number;
35
+ sourcesReused?: number;
36
+ }
37
+ export declare function parseMetadata(materialization: Materialization): MaterializationMetadata;
38
+ /** Human label for how a run was initiated. */
39
+ export declare function triggerLabel(meta: MaterializationMetadata): "Scheduled" | "Manual";
40
+ /** Human-readable elapsed time between two ISO timestamps (to now if open). */
41
+ export declare function formatDuration(startedAt?: string | null, completedAt?: string | null): string;
42
+ /** Absolute, locale-formatted timestamp (e.g. "Jun 19, 2026, 3:33 PM"). */
43
+ export declare function formatTimestamp(iso?: string | null): string;
44
+ /** Compact relative timestamp, e.g. "just now", "5m ago", "2h ago", "3d ago". */
45
+ export declare function formatRelativeTime(iso?: string | null): string;
46
+ export {};
@@ -1,9 +1,52 @@
1
- import { RetrievalFunction } from '../filter/DimensionFilter';
1
+ import { NavigationClick } from '../click_helper';
2
+ import { DrillNavigation } from '../drill';
2
3
  interface NotebookProps {
3
4
  resourceUri: string;
4
5
  maxResultSize?: number;
5
- /** Optional retrieval function for semantic search filters */
6
- retrievalFn?: RetrievalFunction;
6
+ /**
7
+ * Parameter values from the host, typically its URL query parameters: the
8
+ * same contract `Dashboard` takes, so a link into a filtered notebook works
9
+ * the way a link into a filtered dashboard does.
10
+ */
11
+ givens?: Record<string, string>;
12
+ /**
13
+ * Applied parameter values, for a host that wants them in its URL. Fires
14
+ * with what the cells actually ran with, which is what makes the URL a link
15
+ * that reproduces the view.
16
+ *
17
+ * That is every committed change. Under `## autorun=false` a change is
18
+ * committed on Apply, so reports are batched; otherwise every change is
19
+ * committed and typing in a text control reports per keystroke. It does NOT
20
+ * run per keystroke: a changed value waits
21
+ * `GIVEN_SETTLE_MS` before anything is dispatched, so a burst of typing
22
+ * produces one run. A run that does start supersedes and aborts the one
23
+ * before it. The REPORTS are still per keystroke, so a host doing something
24
+ * expensive per call should debounce.
25
+ *
26
+ * `managed` names every given this notebook declares, set or not. A host
27
+ * writing to a shared query string needs it: `givens` alone says which
28
+ * parameters to write but not which to *remove*, and a host that guesses by
29
+ * removing everything it did not just receive deletes the unrelated
30
+ * parameters it has no business touching.
31
+ */
32
+ onGivensChange?: (givens: Record<string, string>, managed: readonly string[]) => void;
33
+ /**
34
+ * Optional SPA navigation handler for links inside the notebook. When
35
+ * omitted, in-notebook links fall back to plain absolute anchors, so no
36
+ * react-router context is required to render a notebook.
37
+ *
38
+ * It does NOT carry drill. A `# drill { to=self }` filters this notebook
39
+ * through `given:` state and needs no handler at all, and a drill naming a
40
+ * dashboard goes through {@link onDrillNavigate}, which takes a destination
41
+ * rather than a URL.
42
+ */
43
+ onNavigate?: (to: string, event?: NavigationClick) => void;
44
+ /**
45
+ * Opens a `# drill { to=<dashboard> }` from a cell, seeded with the clicked
46
+ * value. Omitted on a host with no dashboard route, which leaves those
47
+ * destinations inert AND unmarked rather than painting a dead link.
48
+ */
49
+ onDrillNavigate?: (target: DrillNavigation, event?: MouseEvent) => void;
7
50
  }
8
- export default function Notebook({ resourceUri, maxResultSize, retrievalFn, }: NotebookProps): import("react/jsx-runtime").JSX.Element;
51
+ export default function Notebook({ resourceUri, maxResultSize, givens, onGivensChange, onNavigate, onDrillNavigate, }: NotebookProps): import("react/jsx-runtime").JSX.Element;
9
52
  export {};
@@ -1,3 +1,5 @@
1
+ import { NavigationClick } from '../click_helper';
2
+ import { DrillNavigation } from '../drill';
1
3
  import { EnhancedNotebookCell } from './types';
2
4
  interface NotebookCellProps {
3
5
  cell: EnhancedNotebookCell;
@@ -9,6 +11,40 @@ interface NotebookCellProps {
9
11
  index: number;
10
12
  maxResultSize?: number;
11
13
  isExecuting?: boolean;
14
+ /**
15
+ * A re-run is coming but has not started, i.e. the given-settle window.
16
+ * Separate from `isExecuting` because the spinner below is gated on
17
+ * `!cell.result`, so on a re-run (where a result IS present) it renders
18
+ * nothing at all, which is exactly the case the settle window needs to
19
+ * signal: the values on screen are already stale.
20
+ */
21
+ pendingRerun?: boolean;
22
+ onNavigate?: (to: string, event?: NavigationClick) => void;
23
+ /**
24
+ * Applies a `# drill { to=self }` in place, by setting the named parameter
25
+ * on the notebook that owns this cell. Omitted when the notebook declares no
26
+ * givens, which makes a self-drill inert rather than an error.
27
+ *
28
+ * Takes the clicked value unencoded: only the notebook knows the declared
29
+ * type of the given being set, and the encoding depends on it.
30
+ */
31
+ onDrillSelf?: (given: string, rawValue: unknown) => void;
32
+ /**
33
+ * Whether the owning notebook declares a given, so a `to=self` drill onto it
34
+ * can be honoured. Without it every self-drill reads as clickable and the
35
+ * refusal only shows up in the console.
36
+ */
37
+ canDrillSelf?: (given: string) => boolean;
38
+ /**
39
+ * Opens a `# drill { to=<dashboard> }` destination, seeded with the clicked
40
+ * value. Distinct from {@link onNavigate}, which routes a markdown link and
41
+ * takes a URL: this one takes a destination and the givens to seed, and only
42
+ * the host knows how to turn those into a route.
43
+ *
44
+ * Omitted on a host with no dashboard route, which makes a cross-dashboard
45
+ * drill inert rather than dead-ended, and removes the affordance with it.
46
+ */
47
+ onDrillNavigate?: (target: DrillNavigation, event?: MouseEvent) => void;
12
48
  }
13
- export declare function NotebookCell({ cell, hideCodeCellIcon, hideEmbeddingIcon, resourceUri, index, maxResultSize, isExecuting, }: NotebookCellProps): import("react/jsx-runtime").JSX.Element;
49
+ export declare function NotebookCell({ cell, hideCodeCellIcon, hideEmbeddingIcon, resourceUri, index, maxResultSize, isExecuting, pendingRerun, onNavigate, onDrillSelf, canDrillSelf, onDrillNavigate, }: NotebookCellProps): import("react/jsx-runtime").JSX.Element;
14
50
  export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * What the notebook's run effect should do about the state it just observed.
3
+ *
4
+ * Pulled out as a pure function because the inline version produced two defects
5
+ * that no test could reach: it first lost the bound on concurrent runs
6
+ * entirely, then, once a settle delay put the bound back, it let an abandoned
7
+ * run fire. Both were reasoning errors about
8
+ * three interacting pieces of state, which is exactly what a table of cases
9
+ * pins and a component test does not.
10
+ */
11
+ export interface RunPlanInput {
12
+ /** Whether the notebook is loaded and runnable at all. */
13
+ ready: boolean;
14
+ /** Key of the run that has already been dispatched, or null before the first. */
15
+ lastRunKey: string | null;
16
+ /** Key of a run currently waiting out the settle delay, if any. */
17
+ pendingKey: string | undefined;
18
+ /** Key for the state the notebook is in now. */
19
+ runKey: string;
20
+ /** The `resourceUri|generation` prefix of {@link runKey}, without the parameters. */
21
+ documentKey: string;
22
+ }
23
+ export interface RunPlan {
24
+ /** Clear the pending timer, because what it would run is no longer current. */
25
+ cancelPending: boolean;
26
+ /** `now` skips the settle delay; `settle` waits it out; `none` does nothing. */
27
+ dispatch: "now" | "settle" | "none";
28
+ }
29
+ export declare function planRun({ ready, lastRunKey, pendingKey, runKey, documentKey, }: RunPlanInput): RunPlan;
@@ -18,4 +18,14 @@ export interface EnhancedNotebookCell extends ClientNotebookCell {
18
18
  * that become available in this cell (e.g., from imports or source definitions)
19
19
  */
20
20
  newSources?: string[];
21
+ /**
22
+ * Why this cell has no result, when the server refused to run it.
23
+ *
24
+ * A cell that throws used to be logged to the console and nothing else, so
25
+ * the reader got an empty space with no indication anything had happened.
26
+ * That was survivable while the only way to reach it was a server fault; it
27
+ * stopped being survivable once a model with a required `#(filter)` began
28
+ * failing every cell by design.
29
+ */
30
+ error?: string;
21
31
  }
@@ -0,0 +1,31 @@
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
+ export type ContentType = "report" | "model" | "data" | "materialization" | "dataApp" | "dashboard";
3
+ /**
4
+ * The backplate color behind each icon. One per content type and no repeats: on
5
+ * a page that lists all six, a shared color reads as a shared kind, and the
6
+ * glyphs are small enough that color does most of the telling apart.
7
+ *
8
+ * The logo's three go to the three artifacts a reader opens to look at data,
9
+ * dashboards and notebooks and the models under them, and the accents to the
10
+ * rest, so the brand leads on the things the page is mostly for. Not a
11
+ * seniority ranking: dashboards are the newest thing a package can hold, and
12
+ * Package Data is among the oldest and takes an accent.
13
+ *
14
+ * Exhaustive by type rather than by a default, so adding a `ContentType` is a
15
+ * compile error here instead of a row that silently paints itself the same as
16
+ * its neighbour.
17
+ */
18
+ export declare const CONTENT_TINT: Record<ContentType, string>;
19
+ interface ContentTypeIconProps extends Omit<SvgIconProps, "fontSize"> {
20
+ type: ContentType;
21
+ /** Pixel size of the rendered icon. */
22
+ size?: number;
23
+ }
24
+ /**
25
+ * Inline SVGs that visually match Central Icons'
26
+ * round-outlined-radius-2-stroke-1 family
27
+ * (IconFileChart, Icon3dBoxTop, IconTable). Reimplemented as plain SVG
28
+ * so the SDK does not pick up the paid @central-icons-react dependency.
29
+ */
30
+ export default function ContentTypeIcon({ type, size, sx, ...rest }: ContentTypeIconProps): import("react/jsx-runtime").JSX.Element;
31
+ export {};
@@ -1,10 +1,7 @@
1
1
  import { default as React } from 'react';
2
- import { RetrievalFunction } from '../filter/DimensionFilter';
3
2
  interface PackageProps {
4
3
  onClickPackageFile?: (to: string, event?: React.MouseEvent) => void;
5
4
  resourceUri: string;
6
- /** Optional retrieval function for semantic search filters */
7
- retrievalFn?: RetrievalFunction;
8
5
  }
9
- export default function Package({ onClickPackageFile, resourceUri, retrievalFn, }: PackageProps): import("react/jsx-runtime").JSX.Element;
6
+ export default function Package({ onClickPackageFile, resourceUri, }: PackageProps): import("react/jsx-runtime").JSX.Element;
10
7
  export {};
@@ -1,4 +1,5 @@
1
1
  import { default as React } from 'react';
2
+ import { DrillBinding } from '../drill/useDrill';
2
3
  type MalloyRenderElement = HTMLElement & Record<string, unknown>;
3
4
  declare global {
4
5
  namespace JSX {
@@ -12,7 +13,12 @@ interface RenderedResultProps {
12
13
  height?: number;
13
14
  isFillElement?: (boolean: any) => void;
14
15
  onSizeChange?: (height: number) => void;
15
- onDrill?: (element: unknown) => void;
16
+ /**
17
+ * Makes `# drill` cells clickable, and makes them look it. From `useDrill`
18
+ * on the host surface, which decides where a click may go; omitted where
19
+ * nothing can act on one, and then the result renders inert.
20
+ */
21
+ drill?: DrillBinding;
16
22
  }
17
23
  export default function RenderedResult(props: RenderedResultProps): import("react/jsx-runtime").JSX.Element;
18
24
  export {};
@@ -1,7 +1,11 @@
1
+ import { LogMessage } from '../../client';
2
+ import { DrillBinding } from '../drill/useDrill';
1
3
  interface ResultContainerProps {
2
4
  result: string | undefined;
3
5
  maxHeight: number;
4
6
  maxResultSize?: number;
7
+ renderLogs?: LogMessage[];
8
+ drill?: DrillBinding;
5
9
  }
6
- export default function ResultContainer({ result, maxHeight, maxResultSize, }: ResultContainerProps): import("react/jsx-runtime").JSX.Element;
10
+ export default function ResultContainer({ result, maxHeight, maxResultSize, renderLogs, drill, }: ResultContainerProps): import("react/jsx-runtime").JSX.Element;
7
11
  export {};
@@ -0,0 +1,6 @@
1
+ import { LogMessage } from '../../client';
2
+ export interface RenderLogSummary {
3
+ severity: "warn" | "error";
4
+ title: string;
5
+ }
6
+ export declare function summarizeRenderLogs(logs: LogMessage[] | undefined): RenderLogSummary | undefined;
@@ -1,8 +1,13 @@
1
+ import { LogMessage } from '../client';
2
+ import { DrillBinding } from './drill';
1
3
  interface ResultsDialogProps {
2
4
  open: boolean;
3
5
  onClose: () => void;
4
6
  result: string;
5
7
  title?: string;
8
+ renderLogs?: LogMessage[];
9
+ /** `# drill` wiring, so a result stays clickable when it is expanded. */
10
+ drill?: DrillBinding;
6
11
  }
7
- export default function ResultsDialog({ open, onClose, result, title, }: ResultsDialogProps): import("react/jsx-runtime").JSX.Element;
12
+ export default function ResultsDialog({ open, onClose, result, title, renderLogs, drill, }: ResultsDialogProps): import("react/jsx-runtime").JSX.Element;
8
13
  export {};
@@ -1,11 +1,18 @@
1
1
  import { default as React, ReactNode } from 'react';
2
- import { ConnectionsApi, DatabasesApi, ModelsApi, NotebooksApi, PackagesApi, ProjectsApi, PublisherApi, WatchModeApi } from '../client';
2
+ import { ConnectionsApi, DashboardsApi, DataAppsApi, DatabasesApi, EnvironmentsApi, MaterializationsApi, ModelsApi, NotebooksApi, PackagesApi, PublisherApi, WatchModeApi } from '../client';
3
+ import { Theme } from '../theme/types';
3
4
  export interface ServerContextValue {
4
5
  server: string;
5
6
  getAccessToken?: () => Promise<string>;
6
7
  apiClients: ApiClients;
7
8
  mutable: boolean;
8
9
  isLoadingStatus: boolean;
10
+ /**
11
+ * Instance-wide default theme, pulled from the `/api/v0/status` response.
12
+ * `undefined` while loading, or when the operator has not configured a
13
+ * theme in `publisher.config.json`.
14
+ */
15
+ instanceTheme?: Theme;
9
16
  }
10
17
  export interface ServerProviderProps {
11
18
  children: ReactNode;
@@ -20,23 +27,40 @@ export interface ServerProviderProps {
20
27
  * Will send "Bearer 123" in the Authorization header.
21
28
  */
22
29
  getAccessToken?: () => Promise<string>;
23
- /** Whether the publisher should allow project and package management operations.
24
- * When false, users can only view and explore existing projects and packages.
30
+ /** Whether the publisher should allow environment and package management operations.
31
+ * When false, users can only view and explore existing environments and packages.
25
32
  * @default true
26
33
  */
27
34
  mutable?: boolean;
35
+ /** An optional theme supplied by the embedding app, for a host that wants its
36
+ * own brand palette and fonts on the rendered charts and tables. It is added
37
+ * as the highest-precedence base layer, so it wins over the operator's
38
+ * instance theme from `/status`, while per-chart `# theme` annotations still
39
+ * layer on top. Omit to use only the instance theme. Mode (light/dark) is
40
+ * unaffected, so set both variants of any per-mode key if the host is
41
+ * single-mode.
42
+ */
43
+ theme?: Theme;
28
44
  }
29
45
  declare const getApiClients: (baseURL?: string, accessToken?: () => Promise<string>) => {
30
46
  models: ModelsApi;
31
47
  publisher: PublisherApi;
32
- projects: ProjectsApi;
48
+ environments: EnvironmentsApi;
33
49
  packages: PackagesApi;
50
+ dashboards: DashboardsApi;
51
+ dataApps: DataAppsApi;
34
52
  notebooks: NotebooksApi;
35
53
  connections: ConnectionsApi;
36
54
  databases: DatabasesApi;
55
+ materializations: MaterializationsApi;
37
56
  watchMode: WatchModeApi;
38
57
  };
39
58
  export type ApiClients = ReturnType<typeof getApiClients>;
59
+ /**
60
+ * Outer wrapper that owns the QueryClient. The inner component runs
61
+ * react-query hooks for /status, so it has to live below the
62
+ * QueryClientProvider.
63
+ */
40
64
  export declare const ServerProvider: React.FC<ServerProviderProps>;
41
65
  export declare const useServer: () => ServerContextValue;
42
66
  export {};
@@ -1,8 +1,17 @@
1
1
  import { MouseEvent } from 'react';
2
+ /**
3
+ * The modifier state a navigation decision reads, and nothing more.
4
+ *
5
+ * Both React's synthetic mouse event and the DOM's satisfy it, which is the
6
+ * point. A click can reach navigation from a React handler, or from outside
7
+ * React entirely (a `# drill` click arrives from the Malloy renderer as a plain
8
+ * DOM event), and neither should have to be converted to the other first.
9
+ */
10
+ export type NavigationClick = Pick<MouseEvent, "metaKey" | "ctrlKey" | "shiftKey" | "button">;
2
11
  /**
3
12
  * Custom hook that returns a function for handling clicks with proper modifier key support.
4
13
  * The returned function handles CMD/Ctrl clicks to open in new tabs, regular clicks for navigation.
5
14
  *
6
15
  * @returns A function that takes a relative URL and either navigates or opens in new tab
7
16
  */
8
- export declare function useRouterClickHandler(): (to: string, event?: MouseEvent) => void;
17
+ export declare function useRouterClickHandler(): (to: string, event?: NavigationClick) => void;
@@ -0,0 +1,3 @@
1
+ export { DRILL_CELL_CLASS, drillableFieldNames, markDrillableCells, type DrillMetadataSource, } from './markDrillableCells';
2
+ export { DRILL_SELF, drillDestinations, drillValueToFilter, encodeDrillValue, humanizeSlug, resolveDrill, type DrillClickPayload, type DrillField, type DrillIntent, type DrillNavigation, type DrillTagReader, } from './resolveDrill';
3
+ export { useDrill, type DrillBinding, type UseDrillOptions, type UseDrillResult, } from './useDrill';
@@ -0,0 +1,55 @@
1
+ import { DrillField } from './resolveDrill';
2
+ /**
3
+ * Marks a leaf value cell whose column declares an honorable `# drill`.
4
+ * Malloyyo's counterpart is `dash-drill`; the name is local to each app's
5
+ * stylesheet, and only the tag grammar is a compatibility surface.
6
+ */
7
+ export declare const DRILL_CELL_CLASS = "publisher-drill";
8
+ /** As much of the renderer's viz handle as the affordance reads. */
9
+ export interface DrillMetadataSource {
10
+ getMetadata: () => {
11
+ getAllFields: () => DrillField[];
12
+ } | null | undefined;
13
+ }
14
+ /**
15
+ * The column names to mark: every field whose `# drill` this surface can honor.
16
+ *
17
+ * Both the field's own name and its `# label` go in, because the header cell
18
+ * this is matched against renders `getLabel()`: the label when the author set
19
+ * one, the name otherwise, and the caller cannot tell which from the DOM.
20
+ *
21
+ * `canDrill` is the host's capability filter (see `useDrill`), so a destination
22
+ * the surface cannot reach never becomes a link: a dead link is worse than none.
23
+ */
24
+ export declare function drillableFieldNames(viz: DrillMetadataSource, canDrill: (field: DrillField) => boolean): Set<string>;
25
+ /**
26
+ * Add {@link DRILL_CELL_CLASS} to the cells `names` makes clickable.
27
+ *
28
+ * Per table rather than per container: a nested table has its own grid and its
29
+ * own column numbering, so matching across them would mark whichever column of
30
+ * the child happened to share a number with the parent's.
31
+ *
32
+ * Idempotent, and safe to call repeatedly: a `# dashboard` result builds its
33
+ * cards over several frames, so the caller re-runs this as the DOM settles.
34
+ */
35
+ export declare function markDrillableCells(container: HTMLElement, names: Set<string>): void;
36
+ /**
37
+ * The drillable cells sharing `cell`'s column, in row order, or an empty array
38
+ * when `cell` is not a marked cell.
39
+ *
40
+ * Lives here rather than in the keyboard handler that calls it because the
41
+ * column identity is this module's rule: a cell's column is its inline
42
+ * `grid-column` start, scoped to its own `.malloy-table` so a nested table's
43
+ * numbering never matches the parent's. Two sites deciding that separately is
44
+ * how they come to disagree, so the handler asks this one.
45
+ */
46
+ export declare function drillColumnSiblings(cell: HTMLElement): HTMLElement[];
47
+ /**
48
+ * Move a drillable column's single tab stop `to` rows from `from`, or to the
49
+ * first or last cell, and return the cell that should now take focus.
50
+ *
51
+ * Lives beside {@link drillColumnSiblings} because it enforces the same
52
+ * invariant the marking does: exactly one cell per column carries
53
+ * `tabindex="0"`.
54
+ */
55
+ export declare function moveDrillStop(from: HTMLElement, to: number | "first" | "last"): HTMLElement | undefined;
@@ -0,0 +1,139 @@
1
+ /**
2
+ * The parsed-tag surface this module reads, structurally typed.
3
+ *
4
+ * The renderer hands over an already-parsed `Tag` from `@malloydata/malloy-tag`,
5
+ * so naming the shape rather than importing the class keeps that package a
6
+ * render-time detail: SDK consumers can bundle without it, the same allowance
7
+ * `RenderedResult` makes for its theme annotations.
8
+ */
9
+ export interface DrillTagReader {
10
+ tag(...at: string[]): DrillTagReader | undefined;
11
+ text(...at: string[]): string | undefined;
12
+ textArray(...at: string[]): string[] | undefined;
13
+ }
14
+ /** The clicked field, as much of it as drill reads. */
15
+ export interface DrillField {
16
+ name: string;
17
+ tag?: DrillTagReader;
18
+ /**
19
+ * Whether the field was grouped rather than aggregated. Only dimensions
20
+ * drill: a measure's cell has no dimension value to seed a filter with even
21
+ * when the tag reaches it, so filtering by one would filter by something
22
+ * other than what was clicked. Optional because the renderer's click payload
23
+ * and its field metadata are the two callers and only one is guaranteed to
24
+ * carry the method; absent, the field is taken at its word.
25
+ */
26
+ wasDimension?: () => boolean;
27
+ }
28
+ /**
29
+ * A click from `@malloydata/render`'s `onClick`, narrowed to what drill needs.
30
+ * Mirrors its `MalloyClickEventPayload` without importing it, since the renderer
31
+ * is a lazily-imported dependency here.
32
+ */
33
+ export interface DrillClickPayload {
34
+ field?: DrillField;
35
+ value?: unknown;
36
+ isHeader?: boolean;
37
+ /**
38
+ * The originating click, which the host needs for two things a resolved
39
+ * intent cannot express, where to anchor a menu of destinations, and whether
40
+ * a modifier was held (cmd/ctrl to open in a new tab).
41
+ */
42
+ event?: MouseEvent;
43
+ }
44
+ /** The literal `to=self`: filter the current view instead of leaving it. */
45
+ export declare const DRILL_SELF = "self";
46
+ /**
47
+ * The `to=` destinations a field's `# drill` declares, empty when it declares
48
+ * none or the field cannot drill.
49
+ *
50
+ * Read separately from {@link resolveDrill} because two callers need it: the
51
+ * click, which also needs the clicked value, and the *affordance*, which runs
52
+ * over the result's field metadata before any click to decide which columns read
53
+ * as clickable. Sharing this is what keeps the two honest: a cell that looks
54
+ * clickable is one whose click resolves, because both answers come from here.
55
+ */
56
+ export declare function drillDestinations(field: DrillField | undefined): string[];
57
+ /**
58
+ * A destination slug as a menu label: `category_detail` → `Category detail`.
59
+ *
60
+ * Ported from Malloyyo so the same drill reads the same way in both, rather than
61
+ * naming the file on one and a sentence on the other.
62
+ */
63
+ export declare function humanizeSlug(slug: string): string;
64
+ /**
65
+ * The given a `# drill` on this field would set: `given=` when the tag names
66
+ * one, otherwise the dimension name exactly as the model spells it.
67
+ *
68
+ * Shared with the affordance for the same reason `drillDestinations` is: a cell
69
+ * reads as clickable exactly when clicking it would do something, and deciding
70
+ * "would it" needs the given's name before any click happens.
71
+ */
72
+ export declare function drillGivenName(field: DrillField): string;
73
+ /** Where a `# drill` click wants to go, for the host to route however it routes. */
74
+ export interface DrillNavigation {
75
+ /** The destination dashboard's slug. */
76
+ dashboard: string;
77
+ /**
78
+ * Control values to open it with: the clicked value seeded into the drill's
79
+ * given. Only the seeded given: the source view's other filters are not
80
+ * carried over, since the destination need not bind them.
81
+ */
82
+ givens: Record<string, string>;
83
+ }
84
+ /** What a click asked for, once the tag on the clicked field is read. */
85
+ export interface DrillIntent {
86
+ /** Destinations in declared order: dashboard slugs and/or {@link DRILL_SELF}. */
87
+ to: string[];
88
+ /** The given to seed: the dimension name as spelled, unless `given=` says otherwise. */
89
+ given: string;
90
+ /**
91
+ * The clicked value as Malloy filter syntax, ready to send to a `filter<…>`
92
+ * given. This is the right encoding for a cross-dashboard drill, whose
93
+ * destination declares its own givens and is conventionally `filter<…>`.
94
+ */
95
+ value: string;
96
+ /**
97
+ * The same value before any encoding.
98
+ *
99
+ * Carried because the filter encoding above is only correct for a
100
+ * `filter<…>` target, and a click cannot know what it is aiming at: the
101
+ * destination may be another dashboard entirely. A host that *does* know,
102
+ * `to=self`, where the target given is one of its own: re-encodes from this
103
+ * with {@link encodeDrillValue}. Without it, drilling into a plain `string`
104
+ * given seeded it with backslash-escaped filter syntax and matched nothing.
105
+ */
106
+ rawValue: unknown;
107
+ /** The clicked value as it read on screen, for labelling the destination menu. */
108
+ label: string;
109
+ }
110
+ /**
111
+ * The clicked cell's value as filter syntax, or undefined when it cannot be
112
+ * expressed as one.
113
+ *
114
+ * Encoded from the value's own type rather than the given's, which a click does
115
+ * not know (a notebook cell has no control row to consult). Refusing the cases
116
+ * it cannot encode is deliberate: a drill that filtered by something other than
117
+ * the cell the user clicked would be worse than one that does nothing.
118
+ */
119
+ export declare function drillValueToFilter(value: unknown): string | undefined;
120
+ /**
121
+ * Read the `# drill` intent off a renderer click, or undefined when the click
122
+ * was not on a drillable value.
123
+ *
124
+ * Silent on anything untagged, which is most clicks: this runs on every click
125
+ * the renderer reports, so "not a drill" is the ordinary answer, not a fault.
126
+ */
127
+ export declare function resolveDrill(payload: DrillClickPayload | undefined): DrillIntent | undefined;
128
+ /**
129
+ * A clicked value encoded for a given whose declared type is known.
130
+ *
131
+ * `filter<…>` takes filter syntax, so the value is escaped into a one-value
132
+ * filter list. Every other type takes the value itself: a plain `string` given
133
+ * seeded with `Ben\ &\ Jerry` would match nothing, because the escaping is
134
+ * meaningful only to the filter parser.
135
+ *
136
+ * Undefined when the value has no spelling for that type, which the caller
137
+ * should treat the way it treats an unresolvable drill: do nothing.
138
+ */
139
+ export declare function encodeDrillValue(rawValue: unknown, targetType: string | undefined): string | number | boolean | Date | undefined;
@@ -0,0 +1,63 @@
1
+ import { ReactNode } from 'react';
2
+ import { DrillField, DrillClickPayload, DrillNavigation } from './resolveDrill';
3
+ export interface UseDrillOptions {
4
+ /**
5
+ * Open another dashboard, seeded with the clicked value. Omitted on a surface
6
+ * that cannot navigate, which makes those destinations inert rather than
7
+ * dead-ended.
8
+ */
9
+ onNavigate?: (target: DrillNavigation, event?: MouseEvent) => void;
10
+ /**
11
+ * Apply the clicked value to this surface's own control row (`to=self`).
12
+ * Omitted on a surface that has none, such as a notebook cell.
13
+ */
14
+ onSelf?: (given: string, rawValue: unknown) => void;
15
+ /**
16
+ * Whether a `to=self` drill onto this given can actually be honoured: for a
17
+ * notebook, whether it declares that given at all.
18
+ *
19
+ * Without it the affordance says yes to every self-drill and the click is
20
+ * refused afterwards with a console warning, which is the dead link this
21
+ * module exists to avoid. Absent means "any self-drill is fine", the right
22
+ * default for a surface that binds whatever it is handed.
23
+ */
24
+ canSelf?: (given: string) => boolean;
25
+ /**
26
+ * What `to=self` is called in the menu. A notebook filtering itself is not
27
+ * "this dashboard", and the drill tag: written on a shared model dimension,
28
+ * cannot know which document the reader is in, so the surface names itself.
29
+ */
30
+ selfLabel?: string;
31
+ }
32
+ /**
33
+ * What a surface hands to its result renderer to become drillable: the click
34
+ * handler, and the predicate that decides which cells say so.
35
+ *
36
+ * One object because the two must agree. Passing only the handler is what
37
+ * produced the original asymmetry: clicks worked, but nothing looked clickable.
38
+ */
39
+ export interface DrillBinding {
40
+ /**
41
+ * Every cell click. Most carry no `# drill` and mean nothing, so this
42
+ * tolerates being called constantly.
43
+ */
44
+ onClick: (payload: DrillClickPayload) => void;
45
+ /** Whether this field's cells should read as clickable. */
46
+ canDrill: (field: DrillField) => boolean;
47
+ }
48
+ export interface UseDrillResult {
49
+ /** Hand to `ResultContainer`'s (or `RenderedResult`'s) `drill` prop. */
50
+ drill: DrillBinding;
51
+ /** Render anywhere in the subtree: the menu a multi-destination drill opens. */
52
+ drillMenu: ReactNode;
53
+ }
54
+ /**
55
+ * Click-to-drill for any surface that renders a Malloy result.
56
+ *
57
+ * Shared between the dashboard viewer and notebook cells on purpose: `# drill`
58
+ * is declared on a model *dimension*, so it fires wherever that dimension is
59
+ * grouped, and a notebook can therefore drill into a dashboard with no notebook-
60
+ * specific code. What differs between surfaces is only what they can do about it,
61
+ * which is what the two callbacks express.
62
+ */
63
+ export declare function useDrill({ onNavigate, onSelf, selfLabel, canSelf, }: UseDrillOptions): UseDrillResult;