@malloy-publisher/sdk 0.9.10 → 0.9.12

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 (263) hide show
  1. package/dist/{RenderedResult-Dp1Qdajz.es.js → RenderedResult-CDiXJAh9.es.js} +102 -102
  2. package/dist/RenderedResult-De51QvsZ.cjs.js +153 -0
  3. package/dist/ServerProvider-DKrBcXL7.cjs.js +1 -0
  4. package/dist/{ServerProvider-CQy4jVYK.es.js → ServerProvider-RvKSbvnL.es.js} +622 -587
  5. package/dist/builder/index.cjs.js +78 -130
  6. package/dist/builder/index.es.js +7493 -6769
  7. package/dist/builder-entry.d.ts +3 -0
  8. package/dist/client/api.d.ts +72 -23
  9. package/dist/client/index.cjs.js +1 -1
  10. package/dist/client/index.es.js +1 -1
  11. package/dist/components/AppDialog.d.ts +9 -1
  12. package/dist/components/Connections/common.d.ts +11 -3
  13. package/dist/components/Dashboard/DashboardGrid.d.ts +14 -15
  14. package/dist/components/Dashboard/DashboardTile.d.ts +8 -1
  15. package/dist/components/Dashboard/DashboardView.d.ts +22 -34
  16. package/dist/components/Dashboard/TileCard.d.ts +10 -3
  17. package/dist/components/Dashboard/useStuck.d.ts +15 -7
  18. package/dist/components/DocumentCreate/useDocumentChoices.d.ts +6 -0
  19. package/dist/components/Package/PackageProblems.d.ts +14 -0
  20. package/dist/components/RemoveBadge.d.ts +40 -0
  21. package/dist/components/Report/Report.d.ts +13 -4
  22. package/dist/components/Report/ReportPage.d.ts +60 -0
  23. package/dist/components/Report/layoutRules.d.ts +32 -0
  24. package/dist/components/Report/reportQuery.d.ts +30 -0
  25. package/dist/components/Report/telemetry.d.ts +0 -2
  26. package/dist/components/ReportBuilder/AddTileDialog.d.ts +22 -3
  27. package/dist/components/ReportBuilder/BuilderBar.d.ts +17 -0
  28. package/dist/components/ReportBuilder/BuilderDialogs.d.ts +7 -6
  29. package/dist/components/ReportBuilder/BuilderGrid.d.ts +10 -4
  30. package/dist/components/ReportBuilder/BuilderHeader.d.ts +4 -7
  31. package/dist/components/ReportBuilder/BuilderToolbar.d.ts +88 -0
  32. package/dist/components/ReportBuilder/DrillDialog.d.ts +3 -1
  33. package/dist/components/ReportBuilder/EditorSurface.d.ts +7 -9
  34. package/dist/components/ReportBuilder/FilterDialog.d.ts +3 -1
  35. package/dist/components/ReportBuilder/FilterStrip.d.ts +30 -8
  36. package/dist/components/ReportBuilder/InlineMarkdown.d.ts +4 -4
  37. package/dist/components/ReportBuilder/ReportBuilder.d.ts +49 -12
  38. package/dist/components/ReportBuilder/ReportEditor.d.ts +53 -3
  39. package/dist/components/ReportBuilder/TextTileBody.d.ts +2 -5
  40. package/dist/components/ReportBuilder/TileFrame.d.ts +10 -4
  41. package/dist/components/ReportBuilder/TileMenu.d.ts +12 -9
  42. package/dist/components/ReportBuilder/ViewPicker.d.ts +53 -0
  43. package/dist/components/ReportBuilder/addTileToDocument.d.ts +24 -3
  44. package/dist/components/ReportBuilder/builderControls.d.ts +60 -0
  45. package/dist/components/ReportBuilder/catalog.d.ts +2 -4
  46. package/dist/components/ReportBuilder/inlineEdit.d.ts +9 -10
  47. package/dist/components/ReportBuilder/localGiven.d.ts +12 -0
  48. package/dist/components/ReportBuilder/preview.d.ts +17 -2
  49. package/dist/components/ReportBuilder/readDocument.d.ts +0 -2
  50. package/dist/components/ReportBuilder/readForEditor.d.ts +2 -7
  51. package/dist/components/ReportBuilder/reportTag.d.ts +11 -1
  52. package/dist/components/ReportBuilder/sortable.d.ts +4 -3
  53. package/dist/components/ReportBuilder/testing/inline.d.ts +5 -1
  54. package/dist/components/ReportBuilder/useBuilderSelection.d.ts +0 -1
  55. package/dist/components/ReportBuilder/useBuilderSession.d.ts +21 -12
  56. package/dist/components/ReportBuilder/useDocumentEditor.d.ts +2 -6
  57. package/dist/components/ReportBuilder/useExitGuard.d.ts +3 -0
  58. package/dist/components/ReportBuilder/useFilterForm.d.ts +3 -1
  59. package/dist/components/ReportBuilder/useOpenedDocument.d.ts +0 -4
  60. package/dist/components/ReportBuilder/useReportDraft.d.ts +66 -0
  61. package/dist/components/ReportBuilder/useReportEditor.d.ts +0 -9
  62. package/dist/components/ReportBuilder/useTileEditing.d.ts +6 -3
  63. package/dist/components/ReportBuilder/viewAnnotations.d.ts +9 -0
  64. package/dist/components/ReportBuilder/widthLabel.d.ts +6 -0
  65. package/dist/components/ServerProvider.d.ts +9 -0
  66. package/dist/components/controlTokens.d.ts +45 -0
  67. package/dist/components/drill/markDrillableCells.d.ts +1 -1
  68. package/dist/components/given/FilterButton.d.ts +35 -0
  69. package/dist/components/given/GivensPanel.d.ts +2 -1
  70. package/dist/components/given/filterEditing.d.ts +54 -0
  71. package/dist/components/given/filterSummary.d.ts +9 -0
  72. package/dist/components/given/paramCodec.d.ts +11 -0
  73. package/dist/components/given/required.d.ts +25 -0
  74. package/dist/components/index.d.ts +3 -0
  75. package/dist/components/legacy/index.d.ts +1 -1
  76. package/dist/components/{Report/CellReport.d.ts → legacy/malloynb/CellRunnerView.d.ts} +9 -17
  77. package/dist/components/legacy/{MalloynbCells.d.ts → malloynb/MalloynbCells.d.ts} +3 -3
  78. package/dist/components/legacy/{Notebook.d.ts → malloynb/Notebook.d.ts} +1 -1
  79. package/dist/components/{Notebook → legacy/malloynb}/NotebookCell.d.ts +3 -3
  80. package/dist/components/legacy/malloynb/cellKind.d.ts +5 -0
  81. package/dist/components/{Notebook → legacy/malloynb}/types.d.ts +1 -1
  82. package/dist/components/styles.d.ts +0 -2
  83. package/dist/hooks/useQueryResult.d.ts +7 -0
  84. package/dist/index.cjs.js +16 -19
  85. package/dist/index.es.js +8418 -7722
  86. package/dist/theme/ThemeContext.d.ts +8 -1
  87. package/dist/theme/classes.d.ts +49 -0
  88. package/dist/theme/index.d.ts +2 -0
  89. package/dist/theme/types.d.ts +7 -0
  90. package/dist/theme/ui.d.ts +75 -0
  91. package/dist/{useCompiledDocument-BMPDvdFx.es.js → useCompiledDocument-Bf4RSfB6.es.js} +8669 -7851
  92. package/dist/useCompiledDocument-XsQz85Ri.cjs.js +141 -0
  93. package/package.json +2 -2
  94. package/src/builder-entry.ts +9 -0
  95. package/src/components/AppDialog.tsx +23 -0
  96. package/src/components/Connections/AddConnectionDialog.tsx +34 -2
  97. package/src/components/Connections/EditConnectionDialog.tsx +45 -3
  98. package/src/components/Connections/common.spec.ts +69 -0
  99. package/src/components/Connections/common.ts +132 -0
  100. package/src/components/Dashboard/DashboardGrid.tsx +39 -17
  101. package/src/components/Dashboard/DashboardTile.tsx +19 -2
  102. package/src/components/Dashboard/DashboardView.spec.tsx +216 -15
  103. package/src/components/Dashboard/DashboardView.tsx +137 -155
  104. package/src/components/Dashboard/RowsDialog.tsx +1 -2
  105. package/src/components/Dashboard/TileCard.tsx +28 -10
  106. package/src/components/Dashboard/defaultTileSpan.spec.ts +24 -0
  107. package/src/components/Dashboard/useStuck.ts +28 -17
  108. package/src/components/DocumentCreate/useDocumentChoices.ts +19 -2
  109. package/src/components/Environment/Connections.tsx +1 -0
  110. package/src/components/Package/NewDocumentDialog.spec.tsx +76 -59
  111. package/src/components/Package/NewDocumentDialog.tsx +383 -119
  112. package/src/components/Package/Package.artifacts.spec.tsx +1 -1
  113. package/src/components/Package/Package.create.spec.tsx +7 -6
  114. package/src/components/Package/Package.tsx +10 -7
  115. package/src/components/Package/PackageProblems.spec.tsx +41 -0
  116. package/src/components/Package/PackageProblems.tsx +95 -0
  117. package/src/components/Prose.tsx +12 -7
  118. package/src/components/RemoveBadge.tsx +94 -0
  119. package/src/components/RenderedResult/RenderedResult.tsx +5 -9
  120. package/src/components/RenderedResult/ResultPanel.tsx +59 -3
  121. package/src/components/Report/Report.spec.tsx +50 -32
  122. package/src/components/Report/Report.telemetry.spec.tsx +0 -45
  123. package/src/components/Report/Report.tsx +45 -77
  124. package/src/components/Report/ReportPage.tsx +168 -0
  125. package/src/components/Report/layoutRules.spec.ts +35 -0
  126. package/src/components/Report/layoutRules.ts +55 -0
  127. package/src/components/Report/reportQuery.ts +53 -0
  128. package/src/components/Report/telemetry.ts +0 -2
  129. package/src/components/ReportBuilder/AddTileDialog.spec.tsx +76 -41
  130. package/src/components/ReportBuilder/AddTileDialog.tsx +368 -133
  131. package/src/components/ReportBuilder/BuilderBar.tsx +599 -0
  132. package/src/components/ReportBuilder/BuilderDialogs.tsx +28 -39
  133. package/src/components/ReportBuilder/BuilderGrid.tsx +31 -29
  134. package/src/components/ReportBuilder/BuilderHeader.tsx +63 -75
  135. package/src/components/ReportBuilder/BuilderToolbar.tsx +95 -9
  136. package/src/components/ReportBuilder/DrillDialog.tsx +240 -128
  137. package/src/components/ReportBuilder/EditorSurface.tsx +345 -69
  138. package/src/components/ReportBuilder/FilterDialog.tsx +516 -166
  139. package/src/components/ReportBuilder/FilterStrip.tsx +130 -151
  140. package/src/components/ReportBuilder/InlineMarkdown.tsx +71 -45
  141. package/src/components/ReportBuilder/ReportBuilder.charts.spec.tsx +35 -40
  142. package/src/components/ReportBuilder/ReportBuilder.controls.spec.tsx +491 -0
  143. package/src/components/ReportBuilder/ReportBuilder.exit.spec.tsx +2 -4
  144. package/src/components/ReportBuilder/ReportBuilder.inline.spec.tsx +13 -15
  145. package/src/components/ReportBuilder/ReportBuilder.notebook.spec.tsx +27 -118
  146. package/src/components/ReportBuilder/ReportBuilder.openDraft.spec.tsx +12 -5
  147. package/src/components/ReportBuilder/ReportBuilder.sources.spec.tsx +2 -10
  148. package/src/components/ReportBuilder/ReportBuilder.spec.tsx +37 -31
  149. package/src/components/ReportBuilder/ReportBuilder.textTiles.spec.tsx +22 -15
  150. package/src/components/ReportBuilder/ReportBuilder.tsx +292 -117
  151. package/src/components/ReportBuilder/ReportEditor.emptyStart.spec.tsx +2 -1
  152. package/src/components/ReportBuilder/ReportEditor.modelFilters.spec.tsx +312 -0
  153. package/src/components/ReportBuilder/ReportEditor.notebook.spec.tsx +26 -75
  154. package/src/components/ReportBuilder/ReportEditor.package.spec.tsx +6 -2
  155. package/src/components/ReportBuilder/ReportEditor.resourceUri.spec.tsx +3 -2
  156. package/src/components/ReportBuilder/ReportEditor.spec.tsx +2 -4
  157. package/src/components/ReportBuilder/ReportEditor.textSource.spec.tsx +93 -13
  158. package/src/components/ReportBuilder/ReportEditor.tsx +104 -14
  159. package/src/components/ReportBuilder/TextTileBody.tsx +6 -7
  160. package/src/components/ReportBuilder/TileFrame.tsx +212 -75
  161. package/src/components/ReportBuilder/TileMenu.tsx +241 -140
  162. package/src/components/ReportBuilder/ViewPicker.tsx +349 -0
  163. package/src/components/ReportBuilder/addTile.compile.spec.ts +1 -1
  164. package/src/components/ReportBuilder/addTileToDocument.spec.ts +102 -3
  165. package/src/components/ReportBuilder/addTileToDocument.ts +122 -25
  166. package/src/components/ReportBuilder/builderControls.ts +164 -0
  167. package/src/components/ReportBuilder/builderReport.ts +1 -2
  168. package/src/components/ReportBuilder/catalog.ts +10 -26
  169. package/src/components/ReportBuilder/inlineEdit.tsx +22 -54
  170. package/src/components/ReportBuilder/localGiven.ts +56 -0
  171. package/src/components/ReportBuilder/preview.spec.ts +125 -5
  172. package/src/components/ReportBuilder/preview.ts +60 -44
  173. package/src/components/ReportBuilder/readDocument.spec.ts +16 -22
  174. package/src/components/ReportBuilder/readDocument.ts +14 -11
  175. package/src/components/ReportBuilder/readForEditor.spec.ts +12 -41
  176. package/src/components/ReportBuilder/readForEditor.ts +4 -26
  177. package/src/components/ReportBuilder/reportTag.ts +28 -7
  178. package/src/components/ReportBuilder/sortable.tsx +15 -7
  179. package/src/components/ReportBuilder/spliceDocument.imports.spec.ts +1 -1
  180. package/src/components/ReportBuilder/tagParse.spec.ts +0 -40
  181. package/src/components/ReportBuilder/testing/inline.ts +25 -5
  182. package/src/components/ReportBuilder/testing/reportLayoutParity.json +13 -8
  183. package/src/components/ReportBuilder/textTiles.spec.ts +7 -6
  184. package/src/components/ReportBuilder/useBuilderSelection.ts +35 -0
  185. package/src/components/ReportBuilder/useBuilderSession.spec.ts +2 -2
  186. package/src/components/ReportBuilder/useBuilderSession.ts +21 -13
  187. package/src/components/ReportBuilder/useDocumentEditor.spec.ts +0 -58
  188. package/src/components/ReportBuilder/useDocumentEditor.ts +3 -16
  189. package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +26 -0
  190. package/src/components/ReportBuilder/useEditorCatalog.ts +7 -2
  191. package/src/components/ReportBuilder/useExitGuard.ts +16 -0
  192. package/src/components/ReportBuilder/useFilterForm.spec.tsx +17 -0
  193. package/src/components/ReportBuilder/useFilterForm.ts +5 -1
  194. package/src/components/ReportBuilder/useOpenedDocument.ts +0 -2
  195. package/src/components/ReportBuilder/useReportDraft.spec.ts +149 -0
  196. package/src/components/ReportBuilder/useReportDraft.ts +292 -0
  197. package/src/components/ReportBuilder/useReportEditor.ts +3 -12
  198. package/src/components/ReportBuilder/useSaveChannel.ts +0 -1
  199. package/src/components/ReportBuilder/useTileEditing.ts +43 -12
  200. package/src/components/ReportBuilder/viewAnnotations.ts +29 -0
  201. package/src/components/ReportBuilder/widthLabel.spec.ts +25 -0
  202. package/src/components/ReportBuilder/widthLabel.ts +26 -0
  203. package/src/components/ServerProvider.tsx +11 -0
  204. package/src/components/controlTokens.ts +47 -0
  205. package/src/components/drill/markDrillableCells.ts +2 -1
  206. package/src/components/given/FilterButton.spec.tsx +143 -0
  207. package/src/components/given/FilterButton.tsx +478 -0
  208. package/src/components/given/GivenInput.spec.tsx +47 -0
  209. package/src/components/given/GivenInput.tsx +20 -2
  210. package/src/components/given/GivensPanel.spec.tsx +11 -3
  211. package/src/components/given/GivensPanel.tsx +45 -44
  212. package/src/components/given/filterEditing.ts +60 -0
  213. package/src/components/given/filterSummary.spec.ts +108 -0
  214. package/src/components/given/filterSummary.ts +109 -0
  215. package/src/components/given/paramCodec.ts +1 -1
  216. package/src/components/given/required.spec.ts +60 -0
  217. package/src/components/given/required.ts +78 -0
  218. package/src/components/index.ts +9 -0
  219. package/src/components/legacy/Dashboard.spec.tsx +3 -1
  220. package/src/components/legacy/index.ts +1 -1
  221. package/src/components/{Report/CellReport.spec.tsx → legacy/malloynb/CellRunnerView.spec.tsx} +53 -57
  222. package/src/components/{Report/CellReport.tsx → legacy/malloynb/CellRunnerView.tsx} +122 -136
  223. package/src/components/legacy/{MalloynbCells.tsx → malloynb/MalloynbCells.tsx} +6 -6
  224. package/src/components/legacy/{Notebook.layout.spec.tsx → malloynb/Notebook.layout.spec.tsx} +16 -7
  225. package/src/components/legacy/malloynb/Notebook.served.spec.tsx +84 -0
  226. package/src/components/legacy/{Notebook.spec.tsx → malloynb/Notebook.spec.tsx} +5 -3
  227. package/src/components/legacy/{Notebook.tsx → malloynb/Notebook.tsx} +9 -7
  228. package/src/components/{Notebook → legacy/malloynb}/NotebookCell.tsx +70 -150
  229. package/src/components/legacy/malloynb/cellKind.spec.ts +33 -0
  230. package/src/components/legacy/malloynb/cellKind.ts +24 -0
  231. package/src/components/{Notebook → legacy/malloynb}/types.ts +1 -1
  232. package/src/components/styles.ts +0 -18
  233. package/src/hooks/useGivensState.ts +7 -3
  234. package/src/hooks/useQueryResult.placeholder.spec.ts +44 -0
  235. package/src/hooks/useQueryResult.ts +26 -1
  236. package/src/theme/ThemeContext.tsx +21 -1
  237. package/src/theme/classes.ts +52 -0
  238. package/src/theme/index.ts +8 -0
  239. package/src/theme/resolveTheme.ts +3 -0
  240. package/src/theme/types.ts +7 -0
  241. package/src/theme/ui.spec.tsx +91 -0
  242. package/src/theme/ui.ts +115 -0
  243. package/dist/RenderedResult-BcgYjkZ0.cjs.js +0 -153
  244. package/dist/ServerProvider-B0dUY8be.cjs.js +0 -1
  245. package/dist/components/Notebook/cellKind.d.ts +0 -20
  246. package/dist/components/Report/LinearReport.d.ts +0 -18
  247. package/dist/components/ReportBuilder/SourceViewPicker.d.ts +0 -9
  248. package/dist/components/ReportBuilder/legacyNotebook.d.ts +0 -73
  249. package/dist/components/ReportBuilder/useConversionConfirm.d.ts +0 -20
  250. package/dist/useCompiledDocument-UY28ITET.cjs.js +0 -141
  251. package/src/components/Notebook/cellKind.spec.ts +0 -199
  252. package/src/components/Notebook/cellKind.ts +0 -74
  253. package/src/components/Report/LinearReport.tsx +0 -71
  254. package/src/components/ReportBuilder/SourceViewPicker.tsx +0 -122
  255. package/src/components/ReportBuilder/legacyNotebook.chart.spec.ts +0 -77
  256. package/src/components/ReportBuilder/legacyNotebook.convert.spec.ts +0 -626
  257. package/src/components/ReportBuilder/legacyNotebook.read.spec.ts +0 -338
  258. package/src/components/ReportBuilder/legacyNotebook.ts +0 -1122
  259. package/src/components/ReportBuilder/useConversionConfirm.ts +0 -55
  260. package/src/components/legacy/Notebook.served.spec.tsx +0 -183
  261. /package/dist/components/{Notebook → legacy/malloynb}/runPlan.d.ts +0 -0
  262. /package/src/components/{Notebook → legacy/malloynb}/runPlan.spec.ts +0 -0
  263. /package/src/components/{Notebook → legacy/malloynb}/runPlan.ts +0 -0
@@ -1,20 +1,24 @@
1
1
  // Copyright (c) Credible Data Inc.
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
+ import { reportClasses } from "../../theme/classes";
4
5
  import AddIcon from "@mui/icons-material/Add";
5
6
  import { Box, IconButton, SvgIcon, Typography } from "@mui/material";
6
7
  import type { PointerEvent, ReactNode } from "react";
7
8
  import type { Theme } from "@mui/material";
8
9
  import type { SystemStyleObject } from "@mui/system";
9
10
  import { MOTION_FAST, reducedMotionSx } from "../../theme/motion";
11
+ import { edgeColor, hoverEdgeColor } from "../controlTokens";
12
+ import {
13
+ REMOVE_BADGE_CLASS,
14
+ RemoveBadge,
15
+ removeBadgeRevealSx,
16
+ } from "../RemoveBadge";
10
17
  import { usePublisherTheme } from "../../theme/ThemeContext";
11
18
  import type { ResolvedTheme } from "../../theme/types";
19
+ import { BARE_RING_OFFSET_PX, GRID_GAP_PX } from "../Dashboard/DashboardGrid";
12
20
  import {
13
- BARE_RING_OFFSET_PX,
14
- GRID_GAP_PX,
15
- NOTEBOOK_GAP_PX,
16
- } from "../Dashboard/DashboardGrid";
17
- import {
21
+ TILE_HEADING_CLASS,
18
22
  TileCard,
19
23
  TileHeading,
20
24
  type TileChrome,
@@ -22,6 +26,7 @@ import {
22
26
  } from "../Dashboard/TileCard";
23
27
  import { tileDisplayTitle } from "./tileDisplayTitle";
24
28
  import {
29
+ isTextTile,
25
30
  tileKey,
26
31
  tileLabel,
27
32
  type DashboardTile,
@@ -29,6 +34,7 @@ import {
29
34
  } from "./document";
30
35
  import { gapId } from "./layout";
31
36
  import { GapDroppable, NO_DRAG, TileSortable } from "./sortable";
37
+ import { widthLabel } from "./widthLabel";
32
38
 
33
39
  /**
34
40
  * Everything the builder draws AROUND a tile: the selection outline, the menu
@@ -46,6 +52,8 @@ export function TileFrame({
46
52
  onInsertAfter,
47
53
  onSelect,
48
54
  onOpenMenu,
55
+ onRemove,
56
+ removeBlocked,
49
57
  resizing = false,
50
58
  width,
51
59
  onResizeStart,
@@ -70,6 +78,10 @@ export function TileFrame({
70
78
  onInsertAfter?: () => void;
71
79
  onSelect: () => void;
72
80
  onOpenMenu: (anchor: HTMLElement) => void;
81
+ /** Take the tile off the report, from the × on its corner. */
82
+ onRemove: () => void;
83
+ /** Why it cannot be removed (a saved report keeps one tile); the × says so instead. */
84
+ removeBlocked?: string;
73
85
  /** This tile's edge is being dragged. */
74
86
  resizing?: boolean;
75
87
  /** Dragging the right edge sets the width; absent, the tile has no edge handle (one column, or tags the file does not own). */
@@ -85,6 +97,7 @@ export function TileFrame({
85
97
  children: ReactNode;
86
98
  }) {
87
99
  const { theme } = usePublisherTheme();
100
+ const ui = theme.ui;
88
101
  return (
89
102
  <TileSortable id={tileKey(tile)} index={index}>
90
103
  {({ ref, handleRef }) => (
@@ -100,6 +113,7 @@ export function TileFrame({
100
113
  // A named group, so the name is announced: a label on a plain
101
114
  // element is not.
102
115
  role="group"
116
+ className={reportClasses.builderTile}
103
117
  aria-label={`Tile ${tile.name}`}
104
118
  aria-current={selected}
105
119
  // Keyboard focus anywhere in the tile selects it, as a press
@@ -148,6 +162,12 @@ export function TileFrame({
148
162
  // in is the faded, dashed one — the pair every
149
163
  // drag-and-drop grid draws. Doubled so they outrank
150
164
  // the hover rule below on the tile in hand.
165
+ // Room at the end of a card's heading for the menu
166
+ // button, so a long title wraps before it rather than
167
+ // running under it.
168
+ ...(!bare && {
169
+ [`& .${TILE_HEADING_CLASS}`]: { pr: "36px" },
170
+ }),
151
171
  "&&[data-dnd-dragging]": {
152
172
  opacity: 1,
153
173
  outline: "none",
@@ -160,6 +180,12 @@ export function TileFrame({
160
180
  },
161
181
  "&:hover .builder-affordance, &:focus-within .builder-affordance":
162
182
  { opacity: 1 },
183
+ // The remove ×, as a filter shows it: on hover and focus,
184
+ // and while the tile is selected.
185
+ ...removeBadgeRevealSx,
186
+ ...(selected && {
187
+ [`& .${REMOVE_BADGE_CLASS}`]: { opacity: 1 },
188
+ }),
163
189
  // No hover on a touch screen: the affordances stand.
164
190
  "@media (hover: none)": {
165
191
  "& .builder-affordance": { opacity: 1 },
@@ -185,44 +211,57 @@ export function TileFrame({
185
211
  }}
186
212
  />
187
213
 
214
+ {/* Removing the tile: the × on its corner, the one removal
215
+ control in the builder (a filter's is the same). On the
216
+ selection ring's corner for bare prose, the card's otherwise. */}
217
+ <RemoveBadge
218
+ label={`Remove ${tileLabel(tile)}`}
219
+ onRemove={onRemove}
220
+ {...(removeBlocked ? { disabledReason: removeBlocked } : {})}
221
+ inset={bare ? BARE_RING_OFFSET_PX : 0}
222
+ />
223
+
188
224
  {/* The tile's menu: its chart and drill-through.
189
225
  A press here is never the start of a drag: the
190
226
  sensor refuses to activate from a button. */}
191
- <IconButton
192
- className="builder-affordance"
193
- size="small"
194
- aria-label={`Settings for ${tileLabel(tile)}`}
195
- onClick={(event) => {
196
- event.stopPropagation();
197
- onOpenMenu(event.currentTarget);
198
- }}
199
- sx={{
200
- position: "absolute",
201
- // A tab on the tile's top edge, the same on a card and
202
- // on bare content: centred on the card's border, or on
203
- // a bare tile's ring, so it never covers the tile's title
204
- // or text.
205
- top: `${-((bare ? BARE_RING_OFFSET_PX + 1 : 0) + 12)}px`,
206
- right: bare ? 0 : "12px",
207
- border: theme.cardBorder,
208
- borderRadius: 1,
209
- // A 24px hit target at least, whatever the glyph.
210
- width: 28,
211
- height: 24,
212
- zIndex: 2,
213
- color: theme.tileTitle,
214
- bgcolor: theme.tile,
215
- opacity: selected || menuOpen ? 0.9 : 0,
216
- transition: `opacity ${MOTION_FAST}`,
217
- ...reducedMotionSx,
218
- "&:hover": {
219
- opacity: 1,
220
- bgcolor: theme.tile,
221
- },
222
- }}
223
- >
224
- <SpreadDotsIcon />
225
- </IconButton>
227
+ {/* A text tile has no menu: it is edited in place and removed
228
+ from its ×. */}
229
+ {!isTextTile(tile) && (
230
+ <IconButton
231
+ className="builder-affordance"
232
+ size="small"
233
+ aria-label={`Settings for ${tileLabel(tile)}`}
234
+ onClick={(event) => {
235
+ event.stopPropagation();
236
+ onOpenMenu(event.currentTarget);
237
+ }}
238
+ sx={{
239
+ position: "absolute",
240
+ // Inside the tile, top right: on a card, in its heading
241
+ // row level with the title (the heading leaves room for
242
+ // it: see `TILE_HEADING_CLASS` below); on prose, in its
243
+ // top corner, which a readable line leaves empty. Not
244
+ // astride the edge, half outside the tile it belongs to.
245
+ top: bare ? 0 : `${MENU_INSET_PX}px`,
246
+ right: bare ? 0 : `${MENU_INSET_PX}px`,
247
+ borderRadius: ui.radius.control,
248
+ width: 28,
249
+ height: 28,
250
+ zIndex: 2,
251
+ color: "text.secondary",
252
+ bgcolor: "action.hover",
253
+ opacity: selected || menuOpen ? 1 : 0,
254
+ transition: `opacity ${MOTION_FAST}`,
255
+ ...reducedMotionSx,
256
+ "&:hover": {
257
+ opacity: 1,
258
+ bgcolor: "action.selected",
259
+ },
260
+ }}
261
+ >
262
+ <SpreadDotsIcon />
263
+ </IconButton>
264
+ )}
226
265
 
227
266
  {/* The right edge, which sets the width: dragged, or focused and
228
267
  stepped with the arrow keys a column at a time (Home and End go
@@ -230,7 +269,7 @@ export function TileFrame({
230
269
  never takes a press on it. */}
231
270
  {onResizeStart && (
232
271
  <Box
233
- className="builder-affordance"
272
+ className={`builder-affordance ${reportClasses.widthHandle}`}
234
273
  {...{ [NO_DRAG]: "" }}
235
274
  role="separator"
236
275
  tabIndex={width ? 0 : -1}
@@ -267,14 +306,15 @@ export function TileFrame({
267
306
  onPointerUp={onResizeEnd}
268
307
  onPointerCancel={onResizeEnd}
269
308
  onClick={(event) => event.stopPropagation()}
270
- sx={{
309
+ sx={(mui) => ({
271
310
  position: "absolute",
272
311
  top: 0,
273
312
  bottom: 0,
274
313
  // Straddles the edge, so the target is a usable width
275
- // without eating into the tile's content.
276
- right: "-5px",
277
- width: "10px",
314
+ // without eating into the tile's content; wide enough
315
+ // for the knob at its middle.
316
+ right: "-8px",
317
+ width: "16px",
278
318
  cursor: "col-resize",
279
319
  touchAction: "none",
280
320
  zIndex: 2,
@@ -290,19 +330,87 @@ export function TileFrame({
290
330
  outlineOffset: 1,
291
331
  borderRadius: "3px",
292
332
  },
333
+ // A grip tab at the middle of the edge: the shape a
334
+ // splitter's handle has, so it reads as "drag sideways"
335
+ // without a word. The whole edge strip still takes the
336
+ // drag; the tab is where the eye goes.
337
+ "&::before": {
338
+ content: '""',
339
+ position: "absolute",
340
+ top: "50%",
341
+ left: "50%",
342
+ transform: "translate(-50%, -50%)",
343
+ width: "12px",
344
+ height: "40px",
345
+ boxSizing: "border-box",
346
+ borderRadius: ui.radius.control,
347
+ border: `1px solid ${
348
+ resizing
349
+ ? theme.accent
350
+ : edgeColor(theme.cardBorder)
351
+ }`,
352
+ bgcolor: mui.palette.background.paper,
353
+ boxShadow:
354
+ "0 1px 2px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.08)",
355
+ transition: `border-color ${MOTION_FAST}`,
356
+ },
357
+ // Its two grip lines.
293
358
  "&::after": {
294
359
  content: '""',
295
360
  position: "absolute",
296
361
  top: "50%",
297
362
  left: "50%",
298
363
  transform: "translate(-50%, -50%)",
299
- width: "4px",
300
- height: "28px",
301
- borderRadius: "2px",
302
- bgcolor: theme.accent,
364
+ width: "5px",
365
+ height: "16px",
366
+ borderLeft: `1.5px solid ${
367
+ resizing
368
+ ? theme.accent
369
+ : mui.palette.text.secondary
370
+ }`,
371
+ borderRight: `1.5px solid ${
372
+ resizing
373
+ ? theme.accent
374
+ : mui.palette.text.secondary
375
+ }`,
376
+ boxSizing: "border-box",
377
+ opacity: resizing ? 1 : 0.7,
303
378
  },
304
- }}
305
- />
379
+ "&:hover::before": { borderColor: theme.accent },
380
+ "&:hover::after": {
381
+ borderColor: theme.accent,
382
+ opacity: 1,
383
+ },
384
+ })}
385
+ >
386
+ {/* While dragging, the width it will snap to, in words. The
387
+ separator's own value text says the same to a screen reader. */}
388
+ {resizing && width && (
389
+ <Box
390
+ aria-hidden
391
+ sx={(mui) => ({
392
+ position: "absolute",
393
+ top: "50%",
394
+ // Set against the edge, inside the tile: centred
395
+ // on it, half the label hung past the grid's right
396
+ // edge for a tile that reaches it, where a
397
+ // scrolling host cuts it off.
398
+ right: "50%",
399
+ transform: "translateY(calc(-100% - 28px))",
400
+ px: 1,
401
+ py: 0.5,
402
+ borderRadius: ui.radius.control,
403
+ bgcolor: mui.palette.text.primary,
404
+ color: mui.palette.background.paper,
405
+ ...ui.type.label,
406
+ whiteSpace: "nowrap",
407
+ pointerEvents: "none",
408
+ })}
409
+ >
410
+ {widthLabel(width.span, width.columns)}
411
+ </Box>
412
+ )}
413
+ </Box>
306
414
  )}
307
415
 
308
416
  {onInsertAfter && (
@@ -319,7 +427,7 @@ export function TileFrame({
319
427
  // Centred in the gap below the tile, not on its edge: on
320
428
  // a one-line notebook text tile, an edge-centred button
321
429
  // covered the middle of the text it sits under.
322
- bottom: `-${(bare ? NOTEBOOK_GAP_PX : GRID_GAP_PX) / 2 + 12}px`,
430
+ bottom: `-${GRID_GAP_PX / 2 + 12}px`,
323
431
  left: "50%",
324
432
  transform: "translateX(-50%)",
325
433
  width: 24,
@@ -346,8 +454,11 @@ export function TileFrame({
346
454
  );
347
455
  }
348
456
 
349
- /** How far the selection ring stands outside what it selects: its 2px offset plus its 2px width. */
350
- export const SELECTION_RING_PX = 4;
457
+ /** How far the tile menu button sits in from a card's top and right edges: level with the title. */
458
+ const MENU_INSET_PX = 14;
459
+
460
+ /** How far the selection stands outside what it selects: its halo. */
461
+ export const SELECTION_RING_PX = 7;
351
462
 
352
463
  /**
353
464
  * The builder's selection look, for anything a person can select — a tile,
@@ -362,12 +473,24 @@ export const selectionSx = (
362
473
  selected,
363
474
  flash = false,
364
475
  bare = false,
365
- }: { selected: boolean; flash?: boolean; bare?: boolean },
476
+ ringOffset = BARE_RING_OFFSET_PX,
477
+ }: {
478
+ selected: boolean;
479
+ flash?: boolean;
480
+ bare?: boolean;
481
+ /** How far a bare ring stands off its prose. Only content outside the grid may go wider than the grid's own. */
482
+ ringOffset?: number;
483
+ },
366
484
  ): SystemStyleObject<Theme> => {
485
+ const ui = theme.ui;
367
486
  const ring = selected || flash ? theme.accent : "transparent";
368
- const hoverRing = selected
369
- ? theme.accent
370
- : theme.cardBorder.replace(/^1px solid /, "");
487
+ // A soft band outside the ring, so a selection reads as lifted to the
488
+ // front rather than outlined. Wider and stronger for the undo flash.
489
+ const halo = flash
490
+ ? `0 0 0 6px color-mix(in srgb, ${theme.accent} 25%, transparent)`
491
+ : selected
492
+ ? `0 0 0 4px color-mix(in srgb, ${theme.accent} 14%, transparent)`
493
+ : undefined;
371
494
  const transition = `outline-color ${MOTION_FAST}, border-color ${MOTION_FAST}, opacity ${MOTION_FAST}, box-shadow ${MOTION_FAST}`;
372
495
  if (bare)
373
496
  // Bare content has no padding of its own, so the ring stands off it by
@@ -381,28 +504,42 @@ export const selectionSx = (
381
504
  "&::before": {
382
505
  content: '""',
383
506
  position: "absolute",
384
- inset: `${-BARE_RING_OFFSET_PX}px`,
507
+ inset: `${-ringOffset}px`,
385
508
  borderRadius: 1,
386
509
  border: `2px solid ${ring}`,
510
+ ...(halo && { boxShadow: halo }),
387
511
  pointerEvents: "none",
388
512
  transition,
389
513
  ...reducedMotionSx,
390
514
  },
391
- "&:hover::before": { borderColor: hoverRing },
515
+ // No hover ring: the prose's own wash says it can be edited, and a
516
+ // ring around the wash read as a box drawn round a box.
392
517
  };
393
- // A card carries its own padding, so its ring hugs its edge.
518
+ // A card's ring IS its edge: the card's own border turns the accent and
519
+ // thickens, with the halo outside it. An outline standing off the card
520
+ // drew a second frame around the first, with a gap between them.
521
+ // Hover deepens the card's own edge and lifts it; the ring is selection's
522
+ // alone. A hover ring the shape of the selection ring made a pointed-at tile
523
+ // and a selected one look alike.
394
524
  return {
395
- borderRadius: 1,
396
- outline: `2px solid ${ring}`,
397
- outlineOffset: 2,
398
- ...(flash && {
399
- boxShadow: `0 0 0 6px color-mix(in srgb, ${theme.accent} 25%, transparent)`,
400
- }),
525
+ borderRadius: ui.radius.tile,
526
+ "& > .MuiPaper-root": {
527
+ transition,
528
+ ...reducedMotionSx,
529
+ ...((selected || flash) && {
530
+ borderColor: theme.accent,
531
+ boxShadow: `0 0 0 1px ${theme.accent}${halo ? `, ${halo}` : ""}`,
532
+ }),
533
+ },
401
534
  transition,
402
535
  ...reducedMotionSx,
403
536
  "&:hover": {
404
- outlineColor: hoverRing,
405
537
  boxShadow: theme.shadow.lift,
538
+ ...(!(selected || flash) && {
539
+ "& > .MuiPaper-root": {
540
+ borderColor: hoverEdgeColor(theme.cardBorder, theme.tileTitle),
541
+ },
542
+ }),
406
543
  },
407
544
  };
408
545
  };
@@ -490,7 +627,9 @@ export function GridGuides({ columns }: { columns: number }) {
490
627
  position: "absolute",
491
628
  inset: 0,
492
629
  pointerEvents: "none",
493
- zIndex: 3,
630
+ // Behind the tiles: the bands show in the gaps and the free space a
631
+ // tile can grow into, not over its content.
632
+ zIndex: 0,
494
633
  display: "grid",
495
634
  gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
496
635
  gap: `${GRID_GAP_PX}px`,
@@ -500,12 +639,10 @@ export function GridGuides({ columns }: { columns: number }) {
500
639
  <Box
501
640
  key={column}
502
641
  sx={{
503
- borderLeft: `1px dashed ${theme.accent}`,
504
- borderRight:
505
- column === columns - 1
506
- ? `1px dashed ${theme.accent}`
507
- : "none",
508
- opacity: 0.35,
642
+ // A faint band per column: the tracks a width snaps to.
643
+ bgcolor: theme.accent,
644
+ opacity: 0.06,
645
+ borderRadius: "3px",
509
646
  }}
510
647
  />
511
648
  ))}