@malloy-publisher/sdk 0.2.7 → 0.3.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 (221) hide show
  1. package/README.md +180 -204
  2. package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +134 -0
  3. package/dist/DocumentStorageProvider-tGvodI8f.es.js +24268 -0
  4. package/dist/RenderedResult-CPi6uQWq.cjs.js +115 -0
  5. package/dist/RenderedResult-mDE-4u8S.es.js +542 -0
  6. package/dist/{ServerProvider-xXW1HJOJ.cjs.js → ServerProvider-CH71GsoL.cjs.js} +1 -1
  7. package/dist/{ServerProvider-ksC5Su_x.es.js → ServerProvider-X2Ma0HRs.es.js} +324 -359
  8. package/dist/builder/index.cjs.js +105 -0
  9. package/dist/builder/index.d.ts +2 -0
  10. package/dist/builder/index.es.js +9561 -0
  11. package/dist/builder-entry.d.ts +8 -0
  12. package/dist/client/api.d.ts +13 -1
  13. package/dist/client/index.cjs.js +1 -1
  14. package/dist/client/index.es.js +1 -1
  15. package/dist/components/ApiErrorDisplay.d.ts +1 -2
  16. package/dist/components/Dashboard/Dashboard.d.ts +23 -16
  17. package/dist/components/Dashboard/DashboardGrid.d.ts +67 -0
  18. package/dist/components/Dashboard/DashboardTile.d.ts +6 -1
  19. package/dist/components/Dashboard/ExploreDialog.d.ts +18 -0
  20. package/dist/components/Dashboard/RowsDialog.d.ts +47 -0
  21. package/dist/components/Dashboard/TileCard.d.ts +44 -0
  22. package/dist/components/Dashboard/index.d.ts +2 -0
  23. package/dist/components/Dashboard/promoteMeasureRow.d.ts +40 -0
  24. package/dist/components/Dashboard/telemetry.d.ts +43 -0
  25. package/dist/components/DashboardBuilder/AddTileDialog.d.ts +35 -0
  26. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +29 -0
  27. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +112 -0
  28. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +32 -0
  29. package/dist/components/DashboardBuilder/DiffDialog.d.ts +15 -0
  30. package/dist/components/DashboardBuilder/DrillDialog.d.ts +15 -0
  31. package/dist/components/DashboardBuilder/FilterDialog.d.ts +54 -0
  32. package/dist/components/DashboardBuilder/FilterStrip.d.ts +17 -0
  33. package/dist/components/DashboardBuilder/SettingsPopover.d.ts +20 -0
  34. package/dist/components/DashboardBuilder/TileFrame.d.ts +42 -0
  35. package/dist/components/DashboardBuilder/TileMenu.d.ts +24 -0
  36. package/dist/components/DashboardBuilder/catalog.d.ts +62 -0
  37. package/dist/components/DashboardBuilder/controls.d.ts +157 -0
  38. package/dist/components/DashboardBuilder/diff.d.ts +35 -0
  39. package/dist/components/DashboardBuilder/document.d.ts +218 -0
  40. package/dist/components/DashboardBuilder/layout.d.ts +71 -0
  41. package/dist/components/DashboardBuilder/malloyText.d.ts +45 -0
  42. package/dist/components/DashboardBuilder/preview.d.ts +60 -0
  43. package/dist/components/DashboardBuilder/readDocument.d.ts +106 -0
  44. package/dist/components/DashboardBuilder/sortable.d.ts +51 -0
  45. package/dist/components/DashboardBuilder/spliceDocument.d.ts +44 -0
  46. package/dist/components/DashboardBuilder/testing/fixtures.d.ts +10 -0
  47. package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +22 -0
  48. package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +63 -0
  49. package/dist/components/DashboardBuilder/useDraft.d.ts +13 -0
  50. package/dist/components/DashboardBuilder/useFilterForm.d.ts +65 -0
  51. package/dist/components/DashboardBuilder/useTileReorder.d.ts +22 -0
  52. package/dist/components/DashboardBuilder/useTileResize.d.ts +29 -0
  53. package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +14 -0
  54. package/dist/components/DocumentStorage/DocumentStorage.d.ts +58 -0
  55. package/dist/components/DocumentStorage/DocumentStorageProvider.d.ts +25 -0
  56. package/dist/components/DocumentStorage/index.d.ts +3 -0
  57. package/dist/components/FloatingIconButton.d.ts +16 -0
  58. package/dist/components/Model/index.d.ts +0 -1
  59. package/dist/components/Prose.d.ts +46 -0
  60. package/dist/components/RenderedResult/RenderedResult.d.ts +12 -0
  61. package/dist/components/RenderedResult/ResultContainer.d.ts +7 -1
  62. package/dist/components/RenderedResult/ResultPanel.d.ts +30 -0
  63. package/dist/components/RenderedResult/index.d.ts +2 -0
  64. package/dist/components/RenderedResult/resultSizing.d.ts +183 -0
  65. package/dist/components/drill/index.d.ts +2 -1
  66. package/dist/components/drill/resolveDrill.d.ts +22 -0
  67. package/dist/components/drill/useDrill.d.ts +11 -2
  68. package/dist/components/drill/useDrillSelf.d.ts +46 -0
  69. package/dist/components/given/filterValue.d.ts +63 -0
  70. package/dist/components/given/index.d.ts +1 -0
  71. package/dist/components/given/useGivenUrlParams.d.ts +39 -0
  72. package/dist/components/index.d.ts +3 -3
  73. package/dist/components/styles.d.ts +3 -7
  74. package/dist/core-8NVBCLZh.cjs.js +148 -0
  75. package/dist/{core-BY7vB5gN.es.js → core-B8oMW4sm.es.js} +3540 -2335
  76. package/dist/hooks/index.d.ts +3 -1
  77. package/dist/hooks/useDocumentControls.d.ts +70 -0
  78. package/dist/hooks/useQueryResult.d.ts +40 -0
  79. package/dist/hooks/useSuggestOptions.d.ts +28 -12
  80. package/dist/index.cjs.js +34 -1
  81. package/dist/index.es.js +21487 -79
  82. package/dist/sdk.css +1 -1
  83. package/dist/styles.css +0 -1
  84. package/dist/utils/malloyLiteral.d.ts +11 -0
  85. package/package.json +25 -14
  86. package/src/builder-entry.ts +55 -0
  87. package/src/components/ApiErrorDisplay.tsx +1 -1
  88. package/src/components/Connections/EditConnectionDialog.tsx +96 -86
  89. package/src/components/Dashboard/Dashboard.spec.tsx +7 -10
  90. package/src/components/Dashboard/Dashboard.tsx +184 -229
  91. package/src/components/Dashboard/DashboardGrid.tsx +124 -0
  92. package/src/components/Dashboard/DashboardTile.spec.tsx +30 -6
  93. package/src/components/Dashboard/DashboardTile.tsx +67 -101
  94. package/src/components/Dashboard/ExploreDialog.tsx +84 -0
  95. package/src/components/Dashboard/RowsDialog.spec.ts +42 -0
  96. package/src/components/Dashboard/RowsDialog.tsx +234 -0
  97. package/src/components/Dashboard/TileCard.tsx +120 -0
  98. package/src/components/Dashboard/index.ts +2 -0
  99. package/src/components/Dashboard/promoteMeasureRow.spec.ts +207 -0
  100. package/src/components/Dashboard/promoteMeasureRow.ts +160 -0
  101. package/src/components/Dashboard/telemetry.ts +44 -0
  102. package/src/components/Dashboard/tileGridColumn.spec.ts +1 -1
  103. package/src/components/DashboardBuilder/AddTileDialog.tsx +249 -0
  104. package/src/components/DashboardBuilder/BuilderToolbar.tsx +270 -0
  105. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +858 -0
  106. package/src/components/DashboardBuilder/DashboardBuilder.tsx +653 -0
  107. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +211 -0
  108. package/src/components/DashboardBuilder/DashboardEditor.tsx +493 -0
  109. package/src/components/DashboardBuilder/DiffDialog.tsx +129 -0
  110. package/src/components/DashboardBuilder/DrillDialog.tsx +281 -0
  111. package/src/components/DashboardBuilder/FilterDialog.tsx +581 -0
  112. package/src/components/DashboardBuilder/FilterStrip.tsx +125 -0
  113. package/src/components/DashboardBuilder/SettingsPopover.tsx +168 -0
  114. package/src/components/DashboardBuilder/TileFrame.tsx +380 -0
  115. package/src/components/DashboardBuilder/TileMenu.tsx +188 -0
  116. package/src/components/DashboardBuilder/catalog.spec.ts +215 -0
  117. package/src/components/DashboardBuilder/catalog.ts +225 -0
  118. package/src/components/DashboardBuilder/controls.spec.ts +243 -0
  119. package/src/components/DashboardBuilder/controls.ts +398 -0
  120. package/src/components/DashboardBuilder/diff.spec.ts +44 -0
  121. package/src/components/DashboardBuilder/diff.ts +93 -0
  122. package/src/components/DashboardBuilder/document.ts +209 -0
  123. package/src/components/DashboardBuilder/keepRowStructure.spec.ts +84 -0
  124. package/src/components/DashboardBuilder/layout.ts +143 -0
  125. package/src/components/DashboardBuilder/malloyText.spec.ts +84 -0
  126. package/src/components/DashboardBuilder/malloyText.ts +151 -0
  127. package/src/components/DashboardBuilder/moveIntoGap.spec.ts +90 -0
  128. package/src/components/DashboardBuilder/preview.spec.ts +149 -0
  129. package/src/components/DashboardBuilder/preview.ts +172 -0
  130. package/src/components/DashboardBuilder/readDocument.spec.ts +375 -0
  131. package/src/components/DashboardBuilder/readDocument.ts +467 -0
  132. package/src/components/DashboardBuilder/sortable.tsx +151 -0
  133. package/src/components/DashboardBuilder/spliceDocument.spec.ts +1108 -0
  134. package/src/components/DashboardBuilder/spliceDocument.ts +1098 -0
  135. package/src/components/DashboardBuilder/testing/fixtures.ts +48 -0
  136. package/src/components/DashboardBuilder/useBuilderShortcuts.ts +88 -0
  137. package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +255 -0
  138. package/src/components/DashboardBuilder/useDashboardEditor.ts +193 -0
  139. package/src/components/DashboardBuilder/useDraft.ts +43 -0
  140. package/src/components/DashboardBuilder/useFilterForm.spec.tsx +144 -0
  141. package/src/components/DashboardBuilder/useFilterForm.ts +352 -0
  142. package/src/components/DashboardBuilder/useTileReorder.spec.tsx +97 -0
  143. package/src/components/DashboardBuilder/useTileReorder.ts +115 -0
  144. package/src/components/DashboardBuilder/useTileResize.spec.tsx +121 -0
  145. package/src/components/DashboardBuilder/useTileResize.ts +110 -0
  146. package/src/components/DashboardBuilder/withGaps.spec.ts +96 -0
  147. package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +81 -0
  148. package/src/components/DocumentStorage/BrowserDocumentStorage.ts +105 -0
  149. package/src/components/DocumentStorage/DocumentStorage.ts +73 -0
  150. package/src/components/DocumentStorage/DocumentStorageProvider.tsx +58 -0
  151. package/src/components/DocumentStorage/index.ts +16 -0
  152. package/src/components/Environment/About.tsx +4 -36
  153. package/src/components/FloatingIconButton.tsx +41 -0
  154. package/src/components/Model/Model.tsx +6 -23
  155. package/src/components/Model/ModelCell.tsx +34 -72
  156. package/src/components/Model/index.ts +0 -1
  157. package/src/components/Notebook/Notebook.tsx +27 -156
  158. package/src/components/Notebook/NotebookCell.tsx +37 -191
  159. package/src/components/Prose.spec.tsx +85 -0
  160. package/src/components/Prose.tsx +179 -0
  161. package/src/components/QueryResult/QueryResult.tsx +15 -43
  162. package/src/components/RenderedResult/RenderedResult.tsx +86 -76
  163. package/src/components/RenderedResult/ResultContainer.tsx +25 -36
  164. package/src/components/RenderedResult/ResultPanel.spec.tsx +49 -0
  165. package/src/components/RenderedResult/ResultPanel.tsx +73 -0
  166. package/src/components/RenderedResult/index.ts +16 -0
  167. package/src/components/RenderedResult/resultSizing.spec.ts +249 -0
  168. package/src/components/RenderedResult/resultSizing.ts +308 -0
  169. package/src/components/ResultsDialog.tsx +2 -1
  170. package/src/components/drill/index.ts +6 -0
  171. package/src/components/drill/resolveDrill.ts +22 -1
  172. package/src/components/drill/useDrill.spec.tsx +94 -0
  173. package/src/components/drill/useDrill.tsx +52 -12
  174. package/src/components/drill/useDrillSelf.spec.tsx +64 -0
  175. package/src/components/drill/useDrillSelf.ts +110 -0
  176. package/src/components/given/GivenInput.spec.tsx +196 -2
  177. package/src/components/given/GivenInput.tsx +300 -25
  178. package/src/components/given/GivensPanel.tsx +1 -1
  179. package/src/components/given/filterValue.spec.ts +112 -0
  180. package/src/components/given/filterValue.ts +188 -0
  181. package/src/components/given/index.ts +4 -0
  182. package/src/components/given/useGivenUrlParams.spec.tsx +74 -0
  183. package/src/components/given/useGivenUrlParams.ts +87 -0
  184. package/src/components/index.ts +11 -3
  185. package/src/components/styles.ts +0 -37
  186. package/src/hooks/index.ts +13 -1
  187. package/src/hooks/useDocumentControls.ts +170 -0
  188. package/src/hooks/useGivensState.spec.ts +158 -0
  189. package/src/hooks/useGivensState.ts +114 -23
  190. package/src/hooks/useQueryResult.ts +82 -0
  191. package/src/hooks/useSuggestOptions.dom.spec.ts +60 -1
  192. package/src/hooks/useSuggestOptions.ts +94 -51
  193. package/src/utils/malloyLiteral.spec.ts +43 -0
  194. package/src/utils/malloyLiteral.ts +76 -0
  195. package/vite.config.ts +5 -1
  196. package/dist/components/AnalyzePackageButton.d.ts +0 -6
  197. package/dist/components/Workbook/BrowserWorkbookStorage.d.ts +0 -9
  198. package/dist/components/Workbook/EditableMalloyCell.d.ts +0 -11
  199. package/dist/components/Workbook/ModelPicker.d.ts +0 -11
  200. package/dist/components/Workbook/MutableCell.d.ts +0 -17
  201. package/dist/components/Workbook/Workbook.d.ts +0 -7
  202. package/dist/components/Workbook/WorkbookList.d.ts +0 -7
  203. package/dist/components/Workbook/WorkbookManager.d.ts +0 -84
  204. package/dist/components/Workbook/WorkbookStorage.d.ts +0 -17
  205. package/dist/components/Workbook/WorkbookStorageProvider.d.ts +0 -12
  206. package/dist/components/Workbook/index.d.ts +0 -7
  207. package/dist/core-CWKmWEg2.cjs.js +0 -148
  208. package/dist/index-B0WyZAUA.es.js +0 -66412
  209. package/dist/index-kxVD1RjY.cjs.js +0 -356
  210. package/dist/markdown-editor.css +0 -341
  211. package/src/components/AnalyzePackageButton.tsx +0 -319
  212. package/src/components/Workbook/BrowserWorkbookStorage.ts +0 -64
  213. package/src/components/Workbook/EditableMalloyCell.tsx +0 -49
  214. package/src/components/Workbook/ModelPicker.tsx +0 -134
  215. package/src/components/Workbook/MutableCell.tsx +0 -458
  216. package/src/components/Workbook/Workbook.tsx +0 -501
  217. package/src/components/Workbook/WorkbookList.tsx +0 -110
  218. package/src/components/Workbook/WorkbookManager.ts +0 -214
  219. package/src/components/Workbook/WorkbookStorage.ts +0 -35
  220. package/src/components/Workbook/WorkbookStorageProvider.tsx +0 -40
  221. package/src/components/Workbook/index.ts +0 -10
@@ -40,6 +40,26 @@ export interface DrillClickPayload {
40
40
  * a modifier was held (cmd/ctrl to open in a new tab).
41
41
  */
42
42
  event?: MouseEvent;
43
+ /**
44
+ * Where the click came from, as the host names it — for a dashboard, the
45
+ * tile expression whose result was clicked. Set by the host when it wraps
46
+ * a binding per tile; the renderer never fills it. What "the rows behind
47
+ * this value" runs against is read from here.
48
+ */
49
+ context?: string;
50
+ }
51
+ /**
52
+ * A click asking for the rows behind a value, on a surface that offers them.
53
+ * No tag is involved: any grouped value has rows behind it.
54
+ */
55
+ export interface DrillRowsRequest {
56
+ /** The clicked field's name, as the result spells it. */
57
+ field: string;
58
+ rawValue: unknown;
59
+ /** The value as it read on screen. */
60
+ label: string;
61
+ /** {@link DrillClickPayload.context}, when the host set one. */
62
+ context?: string;
43
63
  }
44
64
  /** The literal `to=self`: filter the current view instead of leaving it. */
45
65
  export declare const DRILL_SELF = "self";
@@ -117,6 +137,8 @@ export interface DrillIntent {
117
137
  * the cell the user clicked would be worse than one that does nothing.
118
138
  */
119
139
  export declare function drillValueToFilter(value: unknown): string | undefined;
140
+ /** How the clicked value read on screen, for a menu label. */
141
+ export declare function drillValueLabel(value: unknown): string;
120
142
  /**
121
143
  * Read the `# drill` intent off a renderer click, or undefined when the click
122
144
  * was not on a drillable value.
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { DrillField, DrillClickPayload, DrillNavigation } from './resolveDrill';
2
+ import { DrillField, DrillClickPayload, DrillNavigation, DrillRowsRequest } from './resolveDrill';
3
3
  export interface UseDrillOptions {
4
4
  /**
5
5
  * Open another dashboard, seeded with the clicked value. Omitted on a surface
@@ -28,6 +28,15 @@ export interface UseDrillOptions {
28
28
  * cannot know which document the reader is in, so the surface names itself.
29
29
  */
30
30
  selfLabel?: string;
31
+ /**
32
+ * Show the rows behind a grouped value. With it, EVERY dimension cell is
33
+ * clickable: one with no `# drill` this surface can honour opens the rows;
34
+ * one with a drill behaves exactly as it does without this option, since a
35
+ * drill is the author's own instruction for that value. Omitted on a
36
+ * surface with nowhere to show them, and cells then click only where a tag
37
+ * says so.
38
+ */
39
+ onRows?: (request: DrillRowsRequest) => void;
31
40
  }
32
41
  /**
33
42
  * What a surface hands to its result renderer to become drillable: the click
@@ -60,4 +69,4 @@ export interface UseDrillResult {
60
69
  * specific code. What differs between surfaces is only what they can do about it,
61
70
  * which is what the two callbacks express.
62
71
  */
63
- export declare function useDrill({ onNavigate, onSelf, selfLabel, canSelf, }: UseDrillOptions): UseDrillResult;
72
+ export declare function useDrill({ onNavigate, onSelf, selfLabel, canSelf, onRows, }: UseDrillOptions): UseDrillResult;
@@ -0,0 +1,46 @@
1
+ import { GivenValue } from '../../hooks/givenValue';
2
+ export interface UseDrillSelfOptions {
3
+ /** Declared type per given name: what this document can set. */
4
+ declaredTypes: ReadonlyMap<string, string | undefined>;
5
+ /** The control row's setter, from `useGivensState`. */
6
+ setGiven: (name: string, value: GivenValue) => void;
7
+ /**
8
+ * How the document names itself in the warning for a tag that names a given
9
+ * it does not declare: a dashboard's slug, a notebook's path.
10
+ */
11
+ documentName: string;
12
+ }
13
+ export interface UseDrillSelfResult {
14
+ /** The declared given a drill tag's name refers to, or undefined. */
15
+ resolveGiven: (given: string) => string | undefined;
16
+ /** For `useDrill`: whether a `to=self` on this given can be honoured. */
17
+ canSelf: (given: string) => boolean;
18
+ /** For `useDrill`: set the given to the clicked value, encoded for its type. */
19
+ onSelf: (given: string, rawValue: unknown) => void;
20
+ }
21
+ /**
22
+ * The `# drill { to=self }` half of a document's drill wiring: which of its
23
+ * givens a tag can set, and setting one from a clicked cell.
24
+ *
25
+ * Shared by the dashboard and the notebook so one tag behaves identically on
26
+ * both surfaces, which used to be two copies of this code with the same
27
+ * warning string in each. Three rules live here:
28
+ *
29
+ * - **Names fold case.** `# drill` with no `given=` falls back to the
30
+ * DIMENSION's spelling, conventionally lower_snake, while givens are
31
+ * conventionally SHOUTED; neither convention can be assumed, so a tag naming
32
+ * `region` finds a declared `REGION` and vice versa. First declaration wins
33
+ * when a model declares both spellings.
34
+ * - **The value is encoded against the DECLARED type**, which is knowable here
35
+ * and is not knowable at the click: `useDrill` hands over the raw cell value
36
+ * for exactly this reason. Passing it straight to `setGiven` skipped the
37
+ * encoder, so a clicked date reached a `number` given as epoch milliseconds
38
+ * and a filter value went unescaped. It is set under the name the MODEL
39
+ * declares, so it reaches the URL and the request under the one name the
40
+ * server knows.
41
+ * - **A refusal is said aloud.** `canSelf` checks only that the name resolves,
42
+ * so a `given=` naming a type the clicked value cannot become still paints a
43
+ * whole column clickable and would then drop every click in silence. Both
44
+ * refusals warn, because each is an authoring mistake with no other symptom.
45
+ */
46
+ export declare function useDrillSelf({ declaredTypes, setGiven, documentName, }: UseDrillSelfOptions): UseDrillSelfResult;
@@ -1,3 +1,4 @@
1
+ import { TemporalFilter } from '@malloydata/malloy-filter';
1
2
  /** True for the `filter<…>` family, whose values are filter syntax, not plain. */
2
3
  export declare function isFilterType(type: string | undefined): boolean;
3
4
  /** The `T` of a `filter<T>`, or undefined for any other type. */
@@ -95,3 +96,65 @@ export declare function encodeAtLeast(value: number): string;
95
96
  * no lower bound at all.
96
97
  */
97
98
  export declare function decodeAtLeast(value: string): number | undefined;
99
+ /**
100
+ * An inclusive number range, which is what a two-handled slider means:
101
+ * `encodeBetween(10, 20)` is `[10 to 20]`, Malloy's `>= 10 and <= 20`. The same
102
+ * spelling Malloyyo's `filters.between` writes, so a value set on either host
103
+ * reads back on the other.
104
+ */
105
+ export declare function encodeBetween(lo: number, hi: number): string;
106
+ /**
107
+ * The bounds back out of {@link encodeBetween}, or undefined for any other
108
+ * filter. Only the closed range round-trips: `(10 to 20]` and its kin exclude an
109
+ * end the slider's thumbs cannot express, and a negated range is not a range at
110
+ * all, so both fall through to the text box rather than being redrawn as
111
+ * something else.
112
+ */
113
+ export declare function decodeBetween(value: string): [number, number] | undefined;
114
+ /**
115
+ * The preset windows a time-range control offers for a `filter<date>` or
116
+ * `filter<timestamp>` given. The same six Malloyyo's `TimeRange` widget ships,
117
+ * spelled in Malloy's filter grammar: `today` is the current day, `7 days` is
118
+ * Malloy's "in the last 7 days", a rolling window ending now.
119
+ *
120
+ * Structured clauses rather than strings so the spelling on the wire is the
121
+ * filter package's own, and {@link decodeTimePreset} compares against the same
122
+ * structure the parser returns rather than against text that may be spelled
123
+ * `7 day`, `7 days` or `7 days` by whoever wrote the URL.
124
+ */
125
+ export declare const TIME_PRESETS: readonly {
126
+ key: string;
127
+ label: string;
128
+ clause: TemporalFilter;
129
+ }[];
130
+ /** The filter text for one of {@link TIME_PRESETS}, by key. */
131
+ export declare function encodeTimePreset(key: string): string | undefined;
132
+ /**
133
+ * Which preset a filter is, or undefined when it is none of them. Matched on the
134
+ * parsed clause, so `7 day` and `7 days` are the same window, and a negated or
135
+ * compound filter is not a preset however it is spelled.
136
+ */
137
+ export declare function decodeTimePreset(value: string): string | undefined;
138
+ /**
139
+ * An inclusive range of whole days, as two `YYYY-MM-DD` strings, in Malloy's
140
+ * filter grammar.
141
+ *
142
+ * Malloy's `A to B` runs from the start of A up to but NOT including the start
143
+ * of B (`filter_compilers.ts`, `case 'to'`), while a reader picking "January
144
+ * 1st to January 31st" means both days. So the end is encoded as the day AFTER
145
+ * the last day picked: `encodeDayRange("2024-01-01", "2024-01-31")` is
146
+ * `2024-01-01 to 2024-02-01`. {@link decodeDayRange} undoes exactly that, so a
147
+ * range written by Malloyyo (which encodes the picked day verbatim) displays
148
+ * here as the days it actually selects.
149
+ */
150
+ export declare function encodeDayRange(firstDay: string, lastDay: string): string;
151
+ /**
152
+ * The inclusive days back out of {@link encodeDayRange}, or undefined for any
153
+ * other filter. Both ends must be whole-day literals: a range with a time of
154
+ * day, a relative end (`2024-01-01 to now`), or a negation is not something two
155
+ * day pickers can show, and falls through to the text box.
156
+ */
157
+ export declare function decodeDayRange(value: string): {
158
+ firstDay: string;
159
+ lastDay: string;
160
+ } | undefined;
@@ -1,2 +1,3 @@
1
1
  export { GivenInput, type GivenInputProps } from './GivenInput';
2
2
  export { GivensPanel, type GivensLayout, type GivensPanelProps, } from './GivensPanel';
3
+ export { useGivenUrlParams, type UseGivenUrlParamsResult, } from './useGivenUrlParams';
@@ -0,0 +1,39 @@
1
+ export interface UseGivenUrlParamsResult {
2
+ /** The query string as a flat record: what a document reads its givens from. */
3
+ params: Record<string, string>;
4
+ /**
5
+ * For a document's `onGivensChange`: writes the applied values into the
6
+ * query string, in place, leaving every parameter that is not a given alone.
7
+ */
8
+ onGivensChange: (next: Record<string, string>, managed: readonly string[]) => void;
9
+ }
10
+ /**
11
+ * Keep a document's control values in the page's query string, so a filtered
12
+ * dashboard or a parameterized notebook is a shareable link.
13
+ *
14
+ * This is the host side of `useGivensState`: the document reports its applied
15
+ * values and the names it manages, this writes them into the URL and feeds the
16
+ * URL back in as `params`. The two Console pages carried a copy each; they
17
+ * agreed line for line, so this is that code once, for any host on
18
+ * react-router.
19
+ *
20
+ * Three things it is careful about, each of which was a bug once:
21
+ *
22
+ * - **Merge, never replace.** The query string is not the document's alone: a
23
+ * tracking tag or any other unrelated parameter shares it, and replacing the
24
+ * whole string dropped those on LOAD, as soon as the first report arrived.
25
+ * Only names that are ours are touched: what the document manages now, plus
26
+ * anything this hook wrote earlier, so a control cleared after a model reload
27
+ * stopped declaring it still gets its parameter removed. That memory outlives
28
+ * a document swap on purpose: the parameter written for the previous
29
+ * document is the stale one the next should clear.
30
+ * - **`hasOwnProperty`, not `in`.** `next` is a plain object literal, so `in`
31
+ * walks its prototype and reports `constructor`, `toString` and friends as
32
+ * present; a given with one of those names could never be cleared.
33
+ * - **Replace, and keep the hash.** Changing a control is not a navigation
34
+ * step, so Back should leave the document rather than walk back through
35
+ * every value tried. And a navigation that names only `search` resolves to an
36
+ * empty fragment, which dropped whatever anchor the reader arrived on;
37
+ * `setSearchParams` has that problem, which is why this navigates itself.
38
+ */
39
+ export declare function useGivenUrlParams(): UseGivenUrlParamsResult;
@@ -1,4 +1,4 @@
1
- export { AnalyzePackageButton } from './AnalyzePackageButton';
1
+ export { ApiErrorDisplay, type ApiErrorDisplayProps } from './ApiErrorDisplay';
2
2
  export { useRouterClickHandler, type NavigationClick } from './click_helper';
3
3
  export * from './Dashboard';
4
4
  export * from './DataAppViewer';
@@ -12,9 +12,9 @@ export * from './Materializations';
12
12
  export * from './Model';
13
13
  export * from './Notebook';
14
14
  export * from './Package';
15
+ export { Prose, type ProseLinkContext, type ProseProps, type ProseVariant, } from './Prose';
15
16
  export * from './QueryResult';
16
17
  export * from './RenderedResult';
17
18
  export { ServerProvider, useServer } from './ServerProvider';
18
19
  export type { ServerContextValue, ServerProviderProps } from './ServerProvider';
19
- export * from './Workbook';
20
- export type { WorkbookStorage } from './Workbook';
20
+ export * from './DocumentStorage';
@@ -50,21 +50,17 @@ export declare const MALLOY_ACCENT: {
50
50
  * `MONO_FONT_FAMILY` defined in the publisher app's theme.
51
51
  */
52
52
  export declare const MONO_FONT_FAMILY = "\"JetBrains Mono\", \"ui-monospace\", \"SFMono-Regular\", \"Menlo\", monospace";
53
- export declare const StyledCard: StyledComponent< CardOwnProps & CommonProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "style" | "classes" | "children" | "elevation" | "square" | "sx" | "variant" | "raised"> & MUIStyledCommonProps<Theme>, {}, {}>;
53
+ export declare const StyledCard: StyledComponent< CardOwnProps & CommonProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "style" | "classes" | "children" | "sx" | "variant" | "square" | "elevation" | "raised"> & MUIStyledCommonProps<Theme>, {}, {}>;
54
54
  export declare const StyledCardContent: StyledComponent< CardContentOwnProps & CommonProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "style" | "classes" | "children" | "sx"> & MUIStyledCommonProps<Theme>, {}, {}>;
55
- export declare const StyledCardMedia: StyledComponent< CardMediaOwnProps & CommonProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "style" | "classes" | "image" | "children" | "sx" | "src"> & MUIStyledCommonProps<Theme>, {}, {}>;
55
+ export declare const StyledCardMedia: StyledComponent< CardMediaOwnProps & CommonProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "style" | "classes" | "children" | "sx" | "image" | "src"> & MUIStyledCommonProps<Theme>, {}, {}>;
56
56
  export declare const CleanNotebookContainer: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
57
- export declare const CleanNotebookHeader: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
58
57
  export declare const CleanNotebookSection: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
59
- export declare const CleanNotebookCell: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
60
58
  export declare const CleanMetricCard: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
61
- export declare const CleanCodeBlock: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
62
- export declare const CleanActionBar: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
63
59
  export declare const StyledExplorerPage: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
64
60
  export declare const StyledExplorerBanner: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
65
61
  export declare const StyledExplorerContent: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
66
62
  export declare const StyledExplorerPanel: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
67
- export declare const PackageCard: StyledComponent< CardOwnProps & CommonProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "style" | "classes" | "children" | "elevation" | "square" | "sx" | "variant" | "raised"> & MUIStyledCommonProps<Theme>, {}, {}>;
63
+ export declare const PackageCard: StyledComponent< CardOwnProps & CommonProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "style" | "classes" | "children" | "sx" | "variant" | "square" | "elevation" | "raised"> & MUIStyledCommonProps<Theme>, {}, {}>;
68
64
  export declare const PackageCardContent: StyledComponent< CardContentOwnProps & CommonProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "style" | "classes" | "children" | "sx"> & MUIStyledCommonProps<Theme>, {}, {}>;
69
65
  export declare const PackageSectionTitle: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
70
66
  export declare const PackageContainer: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;