@malloy-publisher/sdk 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +14 -9
  2. package/dist/{DocumentStorageProvider-tGvodI8f.es.js → DocumentStorageProvider-CyOJ0hqf.es.js} +7114 -6939
  3. package/dist/DocumentStorageProvider-DGPQEd_l.cjs.js +134 -0
  4. package/dist/{RenderedResult-mDE-4u8S.es.js → RenderedResult-BnPzJ9Jf.es.js} +64 -57
  5. package/dist/{RenderedResult-CPi6uQWq.cjs.js → RenderedResult-Dp22kZsQ.cjs.js} +2 -2
  6. package/dist/{ServerProvider-X2Ma0HRs.es.js → ServerProvider-BWOEKg0O.es.js} +1217 -1244
  7. package/dist/ServerProvider-Cc489A3f.cjs.js +1 -0
  8. package/dist/builder/index.cjs.js +41 -41
  9. package/dist/builder/index.es.js +2752 -2831
  10. package/dist/client/api.d.ts +100 -42
  11. package/dist/client/index.cjs.js +1 -1
  12. package/dist/client/index.es.js +1 -1
  13. package/dist/components/AppDialog.d.ts +30 -0
  14. package/dist/components/BackLink.d.ts +32 -0
  15. package/dist/components/Dashboard/DashboardBar.d.ts +21 -0
  16. package/dist/components/Dashboard/telemetry.d.ts +10 -5
  17. package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +12 -10
  18. package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +8 -2
  19. package/dist/components/DashboardBuilder/DashboardEditor.d.ts +8 -10
  20. package/dist/components/DashboardBuilder/newDashboard.d.ts +17 -0
  21. package/dist/components/DashboardBuilder/spliceDocument.d.ts +10 -1
  22. package/dist/components/ItemRow.d.ts +38 -0
  23. package/dist/components/Materializations/MaterializationDetailDialog.d.ts +1 -2
  24. package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -5
  25. package/dist/components/Materializations/Materializations.d.ts +7 -3
  26. package/dist/components/Materializations/ScopeButton.d.ts +18 -0
  27. package/dist/components/Materializations/SectionLabel.d.ts +7 -4
  28. package/dist/components/Materializations/TriggerLabel.d.ts +14 -0
  29. package/dist/components/Materializations/index.d.ts +0 -1
  30. package/dist/components/Package/ContentTypeIcon.d.ts +3 -5
  31. package/dist/components/Package/NewDashboardDialog.d.ts +18 -0
  32. package/dist/components/Package/index.d.ts +0 -1
  33. package/dist/components/PackageSection.d.ts +23 -0
  34. package/dist/components/buttons.d.ts +53 -0
  35. package/dist/components/index.d.ts +5 -0
  36. package/dist/components/styles.d.ts +49 -40
  37. package/dist/hooks/useCrudMutation.d.ts +42 -0
  38. package/dist/index.cjs.js +22 -26
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.es.js +17425 -20672
  41. package/dist/telemetry/consoleEvents.d.ts +60 -0
  42. package/dist/utils/sha256.d.ts +2 -0
  43. package/package.json +1 -1
  44. package/src/components/AppDialog.tsx +115 -0
  45. package/src/components/BackLink.tsx +83 -0
  46. package/src/components/Connections/AddConnectionDialog.tsx +50 -70
  47. package/src/components/Connections/DeleteConnectionDialog.tsx +23 -50
  48. package/src/components/Connections/EditConnectionDialog.tsx +54 -73
  49. package/src/components/Dashboard/DashboardBar.tsx +88 -0
  50. package/src/components/Dashboard/telemetry.ts +10 -3
  51. package/src/components/DashboardBuilder/AddTileDialog.tsx +141 -143
  52. package/src/components/DashboardBuilder/BuilderToolbar.tsx +110 -218
  53. package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +5 -11
  54. package/src/components/DashboardBuilder/DashboardBuilder.tsx +184 -171
  55. package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +163 -0
  56. package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +2 -25
  57. package/src/components/DashboardBuilder/DashboardEditor.tsx +135 -61
  58. package/src/components/DashboardBuilder/DiffDialog.tsx +75 -82
  59. package/src/components/DashboardBuilder/DrillDialog.tsx +144 -156
  60. package/src/components/DashboardBuilder/FilterDialog.tsx +276 -295
  61. package/src/components/DashboardBuilder/FilterStrip.tsx +11 -10
  62. package/src/components/DashboardBuilder/newDashboard.spec.ts +40 -0
  63. package/src/components/DashboardBuilder/newDashboard.ts +48 -0
  64. package/src/components/DashboardBuilder/spliceDocument.spec.ts +53 -0
  65. package/src/components/DashboardBuilder/spliceDocument.ts +45 -8
  66. package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +56 -0
  67. package/src/components/DashboardBuilder/useDashboardEditor.ts +12 -4
  68. package/src/components/Environment/About.tsx +14 -28
  69. package/src/components/Environment/AddPackageDialog.tsx +85 -154
  70. package/src/components/Environment/Connections.tsx +125 -205
  71. package/src/components/Environment/DeletePackageDialog.tsx +32 -77
  72. package/src/components/Environment/EditPackageDialog.tsx +46 -58
  73. package/src/components/Environment/Environment.tsx +34 -36
  74. package/src/components/Environment/Packages.tsx +63 -128
  75. package/src/components/Home/AddEnvironmentDialog.tsx +47 -70
  76. package/src/components/Home/DeleteEnvironmentDialog.tsx +32 -77
  77. package/src/components/Home/EditEnvironmentDialog.tsx +47 -61
  78. package/src/components/Home/Home.tsx +101 -214
  79. package/src/components/ItemRow.tsx +165 -0
  80. package/src/components/Materializations/CreateMaterializationDialog.tsx +34 -51
  81. package/src/components/Materializations/DeleteMaterializationDialog.tsx +31 -53
  82. package/src/components/Materializations/MaterializationDetailDialog.tsx +60 -69
  83. package/src/components/Materializations/MaterializationRunsList.tsx +29 -42
  84. package/src/components/Materializations/Materializations.tsx +137 -140
  85. package/src/components/Materializations/ScopeButton.tsx +85 -0
  86. package/src/components/Materializations/SectionLabel.tsx +7 -4
  87. package/src/components/Materializations/SetScheduleDialog.tsx +48 -89
  88. package/src/components/Materializations/TriggerLabel.tsx +36 -0
  89. package/src/components/Materializations/cron.spec.ts +113 -0
  90. package/src/components/Materializations/index.ts +0 -1
  91. package/src/components/Materializations/utils.spec.ts +182 -0
  92. package/src/components/Package/ContentTypeIcon.spec.ts +22 -37
  93. package/src/components/Package/ContentTypeIcon.tsx +10 -12
  94. package/src/components/Package/NewDashboardDialog.spec.tsx +129 -0
  95. package/src/components/Package/NewDashboardDialog.tsx +265 -0
  96. package/src/components/Package/Package.tsx +179 -238
  97. package/src/components/Package/index.ts +0 -1
  98. package/src/components/PackageSection.tsx +85 -0
  99. package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +198 -0
  100. package/src/components/RenderedResult/RenderedResult.tsx +22 -8
  101. package/src/components/ResultsDialog.tsx +8 -32
  102. package/src/components/buttons.tsx +114 -0
  103. package/src/components/designSystem.spec.tsx +316 -0
  104. package/src/components/given/paramCodec.spec.ts +1 -1
  105. package/src/components/index.ts +10 -0
  106. package/src/components/styles.ts +49 -85
  107. package/src/hooks/useCrudMutation.spec.tsx +119 -0
  108. package/src/hooks/useCrudMutation.tsx +85 -0
  109. package/src/index.ts +9 -0
  110. package/src/telemetry/consoleEvents.spec.ts +130 -0
  111. package/src/telemetry/consoleEvents.ts +124 -0
  112. package/src/theme/defaults.ts +34 -23
  113. package/src/theme/resolveTheme.spec.ts +9 -4
  114. package/src/theme/resolveTheme.ts +12 -8
  115. package/src/utils/sha256.ts +13 -0
  116. package/test/README.md +1 -1
  117. package/test/serverProvider.tsx +5 -2
  118. package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +0 -134
  119. package/dist/ServerProvider-CH71GsoL.cjs.js +0 -1
  120. package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +0 -14
  121. package/dist/components/Materializations/EnvironmentMaterializations.d.ts +0 -7
  122. package/dist/components/Materializations/ScheduleCard.d.ts +0 -20
  123. package/dist/components/Materializations/TriggerChip.d.ts +0 -10
  124. package/dist/components/Package/Models.d.ts +0 -6
  125. package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +0 -179
  126. package/src/components/Materializations/EnvironmentMaterializations.tsx +0 -267
  127. package/src/components/Materializations/ScheduleCard.tsx +0 -231
  128. package/src/components/Materializations/TriggerChip.tsx +0 -44
  129. package/src/components/Package/Models.tsx +0 -71
@@ -5,10 +5,6 @@ import {
5
5
  Box,
6
6
  Button,
7
7
  Checkbox,
8
- Dialog,
9
- DialogActions,
10
- DialogContent,
11
- DialogTitle,
12
8
  ListItemText,
13
9
  MenuItem,
14
10
  Stack,
@@ -17,6 +13,7 @@ import {
17
13
  } from "@mui/material";
18
14
  import { useEffect, useState } from "react";
19
15
  import { usePublisherTheme } from "../../theme/ThemeContext";
16
+ import { AppDialog } from "../AppDialog";
20
17
  import type {
21
18
  DashboardDocument,
22
19
  DashboardDrill,
@@ -120,162 +117,153 @@ export function DrillDialog({
120
117
  };
121
118
 
122
119
  return (
123
- <Dialog open={open} onClose={onClose} maxWidth="sm" fullWidth>
124
- <DialogTitle sx={{ pb: 0.5 }}>
125
- Clickable cells
126
- <Typography
127
- component="div"
128
- variant="caption"
129
- sx={{ color: theme.tileTitle, mt: 0.25 }}
130
- >
131
- A cell in a column that groups by one of these dimensions becomes
132
- a link. Clicking it writes the value into a control — here, or on
133
- the dashboard it opens.
134
- </Typography>
135
- </DialogTitle>
136
- <DialogContent>
137
- <Stack sx={{ gap: 2, pt: 1 }}>
138
- {rows.length === 0 ? (
139
- <Typography variant="body2" sx={{ color: theme.tileTitle }}>
140
- {source ? (
141
- <>
142
- <Box component="code">{source.name}</Box> declares no
143
- dimensions of its own in this file. A drill is a tag
144
- on the dimension&apos;s declaration, so a dimension
145
- the model declares is made clickable in the model; to
146
- make one clickable here, declare it in{" "}
147
- <Box component="code">{source.name}</Box> and group
148
- by it.
149
- </>
150
- ) : (
151
- "This tile's source is not declared in this file."
152
- )}
153
- </Typography>
154
- ) : (
155
- rows.map((row, index) => (
156
- <Box
157
- key={row.name}
158
- sx={{
159
- display: "grid",
160
- gridTemplateColumns: {
161
- xs: "1fr",
162
- sm: "minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr)",
163
- },
164
- gap: 1.5,
165
- alignItems: "start",
166
- }}
167
- >
168
- <Box sx={{ minWidth: 0, pt: 0.75 }}>
169
- <Typography
170
- variant="body2"
171
- sx={{
172
- fontFamily: "ui-monospace, monospace",
173
- fontSize: 13,
174
- }}
175
- >
176
- {row.name}
177
- </Typography>
178
- <Typography
179
- variant="caption"
180
- sx={{
181
- color: theme.tileTitle,
182
- display: "block",
183
- overflow: "hidden",
184
- textOverflow: "ellipsis",
185
- whiteSpace: "nowrap",
186
- }}
187
- title={row.expression}
188
- >
189
- is {row.expression}
190
- </Typography>
191
- </Box>
192
- <TextField
193
- select
194
- size="small"
195
- label="Clicks go to"
196
- value={row.to}
197
- inputProps={{
198
- "aria-label": `Where ${row.name} goes`,
199
- }}
200
- SelectProps={{
201
- multiple: true,
202
- renderValue: (selected) =>
203
- (selected as string[]).length === 0
204
- ? "Not clickable"
205
- : (selected as string[])
206
- .map(labelFor)
207
- .join(", "),
208
- displayEmpty: true,
120
+ <AppDialog
121
+ open={open}
122
+ onClose={onClose}
123
+ title="Clickable cells"
124
+ description="A cell in a column that groups by one of these dimensions becomes a link. Clicking it writes the value into a control — here, or on the dashboard it opens."
125
+ actions={
126
+ <>
127
+ <Button onClick={onClose}>Cancel</Button>
128
+ <Button
129
+ variant="contained"
130
+ onClick={apply}
131
+ disabled={rows.length === 0}
132
+ >
133
+ Apply
134
+ </Button>
135
+ </>
136
+ }
137
+ >
138
+ <Stack sx={{ gap: 2, pt: 1 }}>
139
+ {rows.length === 0 ? (
140
+ <Typography variant="body2" sx={{ color: theme.tileTitle }}>
141
+ {source ? (
142
+ <>
143
+ <Box component="code">{source.name}</Box> declares no
144
+ dimensions of its own in this file. A drill is a tag on
145
+ the dimension&apos;s declaration, so a dimension the
146
+ model declares is made clickable in the model; to make
147
+ one clickable here, declare it in{" "}
148
+ <Box component="code">{source.name}</Box> and group by
149
+ it.
150
+ </>
151
+ ) : (
152
+ "This tile's source is not declared in this file."
153
+ )}
154
+ </Typography>
155
+ ) : (
156
+ rows.map((row, index) => (
157
+ <Box
158
+ key={row.name}
159
+ sx={{
160
+ display: "grid",
161
+ gridTemplateColumns: {
162
+ xs: "1fr",
163
+ sm: "minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr)",
164
+ },
165
+ gap: 1.5,
166
+ alignItems: "start",
167
+ }}
168
+ >
169
+ <Box sx={{ minWidth: 0, pt: 0.75 }}>
170
+ <Typography
171
+ variant="body2"
172
+ sx={{
173
+ fontFamily: "ui-monospace, monospace",
174
+ fontSize: 13,
209
175
  }}
210
- InputLabelProps={{ shrink: true }}
211
- onChange={(event) =>
212
- patch(index, (r) => {
213
- const value = event.target.value as unknown;
214
- r.to = Array.isArray(value)
215
- ? (value as string[])
216
- : String(value).split(",").filter(Boolean);
217
- })
218
- }
219
176
  >
220
- {destinations.map((destination) => (
221
- <MenuItem key={destination} value={destination}>
222
- <Checkbox
223
- size="small"
224
- checked={row.to.includes(destination)}
225
- sx={{ p: 0, mr: 1 }}
226
- />
227
- <ListItemText
228
- primary={labelFor(destination)}
229
- />
230
- </MenuItem>
231
- ))}
232
- </TextField>
233
- <TextField
234
- select
235
- size="small"
236
- label="Sets the control"
237
- value={row.given}
238
- disabled={row.to.length === 0}
239
- inputProps={{
240
- "aria-label": `Control ${row.name} sets`,
177
+ {row.name}
178
+ </Typography>
179
+ <Typography
180
+ variant="caption"
181
+ sx={{
182
+ color: theme.tileTitle,
183
+ display: "block",
184
+ overflow: "hidden",
185
+ textOverflow: "ellipsis",
186
+ whiteSpace: "nowrap",
241
187
  }}
242
- SelectProps={{ displayEmpty: true }}
243
- InputLabelProps={{ shrink: true }}
244
- helperText={
245
- row.given === ""
246
- ? `Named ${row.name}, like the dimension`
247
- : undefined
248
- }
249
- onChange={(event) =>
250
- patch(index, (r) => {
251
- r.given = event.target.value;
252
- })
253
- }
188
+ title={row.expression}
254
189
  >
255
- <MenuItem value="">
256
- <em>Same name as the dimension</em>
257
- </MenuItem>
258
- {givenNames.map((name) => (
259
- <MenuItem key={name} value={name}>
260
- {name}
261
- </MenuItem>
262
- ))}
263
- </TextField>
190
+ is {row.expression}
191
+ </Typography>
264
192
  </Box>
265
- ))
266
- )}
267
- </Stack>
268
- </DialogContent>
269
- <DialogActions sx={{ px: 3, py: 1.5 }}>
270
- <Button onClick={onClose}>Cancel</Button>
271
- <Button
272
- variant="contained"
273
- disabled={rows.length === 0}
274
- onClick={apply}
275
- >
276
- Apply
277
- </Button>
278
- </DialogActions>
279
- </Dialog>
193
+ <TextField
194
+ select
195
+ size="small"
196
+ label="Clicks go to"
197
+ value={row.to}
198
+ inputProps={{
199
+ "aria-label": `Where ${row.name} goes`,
200
+ }}
201
+ SelectProps={{
202
+ multiple: true,
203
+ renderValue: (selected) =>
204
+ (selected as string[]).length === 0
205
+ ? "Not clickable"
206
+ : (selected as string[])
207
+ .map(labelFor)
208
+ .join(", "),
209
+ displayEmpty: true,
210
+ }}
211
+ InputLabelProps={{ shrink: true }}
212
+ onChange={(event) =>
213
+ patch(index, (r) => {
214
+ const value = event.target.value as unknown;
215
+ r.to = Array.isArray(value)
216
+ ? (value as string[])
217
+ : String(value).split(",").filter(Boolean);
218
+ })
219
+ }
220
+ >
221
+ {destinations.map((destination) => (
222
+ <MenuItem key={destination} value={destination}>
223
+ <Checkbox
224
+ size="small"
225
+ checked={row.to.includes(destination)}
226
+ sx={{ p: 0, mr: 1 }}
227
+ />
228
+ <ListItemText primary={labelFor(destination)} />
229
+ </MenuItem>
230
+ ))}
231
+ </TextField>
232
+ <TextField
233
+ select
234
+ size="small"
235
+ label="Sets the control"
236
+ value={row.given}
237
+ disabled={row.to.length === 0}
238
+ inputProps={{
239
+ "aria-label": `Control ${row.name} sets`,
240
+ }}
241
+ SelectProps={{ displayEmpty: true }}
242
+ InputLabelProps={{ shrink: true }}
243
+ helperText={
244
+ row.given === ""
245
+ ? `Named ${row.name}, like the dimension`
246
+ : undefined
247
+ }
248
+ onChange={(event) =>
249
+ patch(index, (r) => {
250
+ r.given = event.target.value;
251
+ })
252
+ }
253
+ >
254
+ <MenuItem value="">
255
+ <em>Same name as the dimension</em>
256
+ </MenuItem>
257
+ {givenNames.map((name) => (
258
+ <MenuItem key={name} value={name}>
259
+ {name}
260
+ </MenuItem>
261
+ ))}
262
+ </TextField>
263
+ </Box>
264
+ ))
265
+ )}
266
+ </Stack>
267
+ </AppDialog>
280
268
  );
281
269
  }