@malloy-publisher/sdk 0.9.10 → 0.9.11
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.
- package/dist/RenderedResult-BlNoIiSi.cjs.js +153 -0
- package/dist/{RenderedResult-Dp1Qdajz.es.js → RenderedResult-Cmx8sX8d.es.js} +102 -102
- package/dist/ServerProvider-BOgiW8MX.cjs.js +1 -0
- package/dist/{ServerProvider-CQy4jVYK.es.js → ServerProvider-azXLkk1q.es.js} +619 -586
- package/dist/builder/index.cjs.js +78 -130
- package/dist/builder/index.es.js +7493 -6769
- package/dist/builder-entry.d.ts +3 -0
- package/dist/client/api.d.ts +26 -22
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +9 -1
- package/dist/components/Dashboard/DashboardGrid.d.ts +14 -15
- package/dist/components/Dashboard/DashboardTile.d.ts +8 -1
- package/dist/components/Dashboard/DashboardView.d.ts +22 -34
- package/dist/components/Dashboard/TileCard.d.ts +10 -3
- package/dist/components/Dashboard/useStuck.d.ts +15 -7
- package/dist/components/DocumentCreate/useDocumentChoices.d.ts +6 -0
- package/dist/components/Package/PackageProblems.d.ts +14 -0
- package/dist/components/RemoveBadge.d.ts +40 -0
- package/dist/components/Report/Report.d.ts +13 -4
- package/dist/components/Report/ReportPage.d.ts +60 -0
- package/dist/components/Report/layoutRules.d.ts +32 -0
- package/dist/components/Report/reportQuery.d.ts +30 -0
- package/dist/components/Report/telemetry.d.ts +0 -2
- package/dist/components/ReportBuilder/AddTileDialog.d.ts +22 -3
- package/dist/components/ReportBuilder/BuilderBar.d.ts +17 -0
- package/dist/components/ReportBuilder/BuilderDialogs.d.ts +7 -6
- package/dist/components/ReportBuilder/BuilderGrid.d.ts +10 -4
- package/dist/components/ReportBuilder/BuilderHeader.d.ts +4 -7
- package/dist/components/ReportBuilder/BuilderToolbar.d.ts +88 -0
- package/dist/components/ReportBuilder/DrillDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/EditorSurface.d.ts +7 -9
- package/dist/components/ReportBuilder/FilterDialog.d.ts +3 -1
- package/dist/components/ReportBuilder/FilterStrip.d.ts +30 -8
- package/dist/components/ReportBuilder/InlineMarkdown.d.ts +4 -4
- package/dist/components/ReportBuilder/ReportBuilder.d.ts +49 -12
- package/dist/components/ReportBuilder/ReportEditor.d.ts +53 -3
- package/dist/components/ReportBuilder/TextTileBody.d.ts +2 -5
- package/dist/components/ReportBuilder/TileFrame.d.ts +10 -4
- package/dist/components/ReportBuilder/TileMenu.d.ts +12 -9
- package/dist/components/ReportBuilder/ViewPicker.d.ts +53 -0
- package/dist/components/ReportBuilder/addTileToDocument.d.ts +24 -3
- package/dist/components/ReportBuilder/builderControls.d.ts +60 -0
- package/dist/components/ReportBuilder/catalog.d.ts +2 -4
- package/dist/components/ReportBuilder/inlineEdit.d.ts +9 -10
- package/dist/components/ReportBuilder/localGiven.d.ts +12 -0
- package/dist/components/ReportBuilder/preview.d.ts +17 -2
- package/dist/components/ReportBuilder/readDocument.d.ts +0 -2
- package/dist/components/ReportBuilder/readForEditor.d.ts +2 -7
- package/dist/components/ReportBuilder/reportTag.d.ts +11 -1
- package/dist/components/ReportBuilder/sortable.d.ts +4 -3
- package/dist/components/ReportBuilder/testing/inline.d.ts +5 -1
- package/dist/components/ReportBuilder/useBuilderSelection.d.ts +0 -1
- package/dist/components/ReportBuilder/useBuilderSession.d.ts +21 -12
- package/dist/components/ReportBuilder/useDocumentEditor.d.ts +2 -6
- package/dist/components/ReportBuilder/useExitGuard.d.ts +3 -0
- package/dist/components/ReportBuilder/useFilterForm.d.ts +3 -1
- package/dist/components/ReportBuilder/useOpenedDocument.d.ts +0 -4
- package/dist/components/ReportBuilder/useReportDraft.d.ts +66 -0
- package/dist/components/ReportBuilder/useReportEditor.d.ts +0 -9
- package/dist/components/ReportBuilder/useTileEditing.d.ts +6 -3
- package/dist/components/ReportBuilder/viewAnnotations.d.ts +9 -0
- package/dist/components/ReportBuilder/widthLabel.d.ts +6 -0
- package/dist/components/ServerProvider.d.ts +9 -0
- package/dist/components/controlTokens.d.ts +45 -0
- package/dist/components/drill/markDrillableCells.d.ts +1 -1
- package/dist/components/given/FilterButton.d.ts +35 -0
- package/dist/components/given/GivensPanel.d.ts +2 -1
- package/dist/components/given/filterEditing.d.ts +54 -0
- package/dist/components/given/filterSummary.d.ts +9 -0
- package/dist/components/given/paramCodec.d.ts +11 -0
- package/dist/components/given/required.d.ts +25 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/legacy/index.d.ts +1 -1
- package/dist/components/{Report/CellReport.d.ts → legacy/malloynb/CellRunnerView.d.ts} +9 -17
- package/dist/components/legacy/{MalloynbCells.d.ts → malloynb/MalloynbCells.d.ts} +3 -3
- package/dist/components/legacy/{Notebook.d.ts → malloynb/Notebook.d.ts} +1 -1
- package/dist/components/{Notebook → legacy/malloynb}/NotebookCell.d.ts +3 -3
- package/dist/components/legacy/malloynb/cellKind.d.ts +5 -0
- package/dist/components/{Notebook → legacy/malloynb}/types.d.ts +1 -1
- package/dist/components/styles.d.ts +0 -2
- package/dist/hooks/useQueryResult.d.ts +7 -0
- package/dist/index.cjs.js +16 -19
- package/dist/index.es.js +8324 -7769
- package/dist/theme/ThemeContext.d.ts +8 -1
- package/dist/theme/classes.d.ts +49 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/ui.d.ts +75 -0
- package/dist/{useCompiledDocument-BMPDvdFx.es.js → useCompiledDocument-7j5cBjQd.es.js} +8669 -7851
- package/dist/useCompiledDocument-B21sVbb4.cjs.js +141 -0
- package/package.json +2 -2
- package/src/builder-entry.ts +9 -0
- package/src/components/AppDialog.tsx +23 -0
- package/src/components/Dashboard/DashboardGrid.tsx +39 -17
- package/src/components/Dashboard/DashboardTile.tsx +19 -2
- package/src/components/Dashboard/DashboardView.spec.tsx +216 -15
- package/src/components/Dashboard/DashboardView.tsx +137 -155
- package/src/components/Dashboard/RowsDialog.tsx +1 -2
- package/src/components/Dashboard/TileCard.tsx +28 -10
- package/src/components/Dashboard/defaultTileSpan.spec.ts +24 -0
- package/src/components/Dashboard/useStuck.ts +28 -17
- package/src/components/DocumentCreate/useDocumentChoices.ts +19 -2
- package/src/components/Package/NewDocumentDialog.spec.tsx +76 -59
- package/src/components/Package/NewDocumentDialog.tsx +383 -119
- package/src/components/Package/Package.artifacts.spec.tsx +1 -1
- package/src/components/Package/Package.create.spec.tsx +7 -6
- package/src/components/Package/Package.tsx +10 -7
- package/src/components/Package/PackageProblems.spec.tsx +41 -0
- package/src/components/Package/PackageProblems.tsx +95 -0
- package/src/components/Prose.tsx +12 -7
- package/src/components/RemoveBadge.tsx +94 -0
- package/src/components/RenderedResult/RenderedResult.tsx +5 -9
- package/src/components/RenderedResult/ResultPanel.tsx +59 -3
- package/src/components/Report/Report.spec.tsx +50 -32
- package/src/components/Report/Report.telemetry.spec.tsx +0 -45
- package/src/components/Report/Report.tsx +45 -77
- package/src/components/Report/ReportPage.tsx +168 -0
- package/src/components/Report/layoutRules.spec.ts +35 -0
- package/src/components/Report/layoutRules.ts +55 -0
- package/src/components/Report/reportQuery.ts +53 -0
- package/src/components/Report/telemetry.ts +0 -2
- package/src/components/ReportBuilder/AddTileDialog.spec.tsx +76 -41
- package/src/components/ReportBuilder/AddTileDialog.tsx +368 -133
- package/src/components/ReportBuilder/BuilderBar.tsx +599 -0
- package/src/components/ReportBuilder/BuilderDialogs.tsx +28 -39
- package/src/components/ReportBuilder/BuilderGrid.tsx +31 -29
- package/src/components/ReportBuilder/BuilderHeader.tsx +63 -75
- package/src/components/ReportBuilder/BuilderToolbar.tsx +95 -9
- package/src/components/ReportBuilder/DrillDialog.tsx +240 -128
- package/src/components/ReportBuilder/EditorSurface.tsx +345 -69
- package/src/components/ReportBuilder/FilterDialog.tsx +516 -166
- package/src/components/ReportBuilder/FilterStrip.tsx +130 -151
- package/src/components/ReportBuilder/InlineMarkdown.tsx +71 -45
- package/src/components/ReportBuilder/ReportBuilder.charts.spec.tsx +35 -40
- package/src/components/ReportBuilder/ReportBuilder.controls.spec.tsx +491 -0
- package/src/components/ReportBuilder/ReportBuilder.exit.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportBuilder.inline.spec.tsx +13 -15
- package/src/components/ReportBuilder/ReportBuilder.notebook.spec.tsx +27 -118
- package/src/components/ReportBuilder/ReportBuilder.openDraft.spec.tsx +12 -5
- package/src/components/ReportBuilder/ReportBuilder.sources.spec.tsx +2 -10
- package/src/components/ReportBuilder/ReportBuilder.spec.tsx +37 -31
- package/src/components/ReportBuilder/ReportBuilder.textTiles.spec.tsx +22 -15
- package/src/components/ReportBuilder/ReportBuilder.tsx +292 -117
- package/src/components/ReportBuilder/ReportEditor.emptyStart.spec.tsx +2 -1
- package/src/components/ReportBuilder/ReportEditor.modelFilters.spec.tsx +312 -0
- package/src/components/ReportBuilder/ReportEditor.notebook.spec.tsx +26 -75
- package/src/components/ReportBuilder/ReportEditor.package.spec.tsx +6 -2
- package/src/components/ReportBuilder/ReportEditor.resourceUri.spec.tsx +3 -2
- package/src/components/ReportBuilder/ReportEditor.spec.tsx +2 -4
- package/src/components/ReportBuilder/ReportEditor.textSource.spec.tsx +93 -13
- package/src/components/ReportBuilder/ReportEditor.tsx +104 -14
- package/src/components/ReportBuilder/TextTileBody.tsx +6 -7
- package/src/components/ReportBuilder/TileFrame.tsx +212 -75
- package/src/components/ReportBuilder/TileMenu.tsx +241 -140
- package/src/components/ReportBuilder/ViewPicker.tsx +349 -0
- package/src/components/ReportBuilder/addTile.compile.spec.ts +1 -1
- package/src/components/ReportBuilder/addTileToDocument.spec.ts +102 -3
- package/src/components/ReportBuilder/addTileToDocument.ts +122 -25
- package/src/components/ReportBuilder/builderControls.ts +164 -0
- package/src/components/ReportBuilder/builderReport.ts +1 -2
- package/src/components/ReportBuilder/catalog.ts +10 -26
- package/src/components/ReportBuilder/inlineEdit.tsx +22 -54
- package/src/components/ReportBuilder/localGiven.ts +56 -0
- package/src/components/ReportBuilder/preview.spec.ts +125 -5
- package/src/components/ReportBuilder/preview.ts +60 -44
- package/src/components/ReportBuilder/readDocument.spec.ts +16 -22
- package/src/components/ReportBuilder/readDocument.ts +14 -11
- package/src/components/ReportBuilder/readForEditor.spec.ts +12 -41
- package/src/components/ReportBuilder/readForEditor.ts +4 -26
- package/src/components/ReportBuilder/reportTag.ts +28 -7
- package/src/components/ReportBuilder/sortable.tsx +15 -7
- package/src/components/ReportBuilder/spliceDocument.imports.spec.ts +1 -1
- package/src/components/ReportBuilder/tagParse.spec.ts +0 -40
- package/src/components/ReportBuilder/testing/inline.ts +25 -5
- package/src/components/ReportBuilder/testing/reportLayoutParity.json +13 -8
- package/src/components/ReportBuilder/textTiles.spec.ts +7 -6
- package/src/components/ReportBuilder/useBuilderSelection.ts +35 -0
- package/src/components/ReportBuilder/useBuilderSession.spec.ts +2 -2
- package/src/components/ReportBuilder/useBuilderSession.ts +21 -13
- package/src/components/ReportBuilder/useDocumentEditor.spec.ts +0 -58
- package/src/components/ReportBuilder/useDocumentEditor.ts +3 -16
- package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +26 -0
- package/src/components/ReportBuilder/useEditorCatalog.ts +7 -2
- package/src/components/ReportBuilder/useExitGuard.ts +16 -0
- package/src/components/ReportBuilder/useFilterForm.spec.tsx +17 -0
- package/src/components/ReportBuilder/useFilterForm.ts +5 -1
- package/src/components/ReportBuilder/useOpenedDocument.ts +0 -2
- package/src/components/ReportBuilder/useReportDraft.spec.ts +149 -0
- package/src/components/ReportBuilder/useReportDraft.ts +292 -0
- package/src/components/ReportBuilder/useReportEditor.ts +3 -12
- package/src/components/ReportBuilder/useSaveChannel.ts +0 -1
- package/src/components/ReportBuilder/useTileEditing.ts +43 -12
- package/src/components/ReportBuilder/viewAnnotations.ts +29 -0
- package/src/components/ReportBuilder/widthLabel.spec.ts +25 -0
- package/src/components/ReportBuilder/widthLabel.ts +26 -0
- package/src/components/ServerProvider.tsx +11 -0
- package/src/components/controlTokens.ts +47 -0
- package/src/components/drill/markDrillableCells.ts +2 -1
- package/src/components/given/FilterButton.spec.tsx +143 -0
- package/src/components/given/FilterButton.tsx +478 -0
- package/src/components/given/GivenInput.spec.tsx +47 -0
- package/src/components/given/GivenInput.tsx +20 -2
- package/src/components/given/GivensPanel.spec.tsx +11 -3
- package/src/components/given/GivensPanel.tsx +45 -44
- package/src/components/given/filterEditing.ts +60 -0
- package/src/components/given/filterSummary.spec.ts +108 -0
- package/src/components/given/filterSummary.ts +109 -0
- package/src/components/given/paramCodec.ts +1 -1
- package/src/components/given/required.spec.ts +60 -0
- package/src/components/given/required.ts +78 -0
- package/src/components/index.ts +9 -0
- package/src/components/legacy/Dashboard.spec.tsx +3 -1
- package/src/components/legacy/index.ts +1 -1
- package/src/components/{Report/CellReport.spec.tsx → legacy/malloynb/CellRunnerView.spec.tsx} +53 -57
- package/src/components/{Report/CellReport.tsx → legacy/malloynb/CellRunnerView.tsx} +122 -136
- package/src/components/legacy/{MalloynbCells.tsx → malloynb/MalloynbCells.tsx} +6 -6
- package/src/components/legacy/{Notebook.layout.spec.tsx → malloynb/Notebook.layout.spec.tsx} +16 -7
- package/src/components/legacy/malloynb/Notebook.served.spec.tsx +84 -0
- package/src/components/legacy/{Notebook.spec.tsx → malloynb/Notebook.spec.tsx} +5 -3
- package/src/components/legacy/{Notebook.tsx → malloynb/Notebook.tsx} +9 -7
- package/src/components/{Notebook → legacy/malloynb}/NotebookCell.tsx +70 -150
- package/src/components/legacy/malloynb/cellKind.spec.ts +33 -0
- package/src/components/legacy/malloynb/cellKind.ts +24 -0
- package/src/components/{Notebook → legacy/malloynb}/types.ts +1 -1
- package/src/components/styles.ts +0 -18
- package/src/hooks/useGivensState.ts +7 -3
- package/src/hooks/useQueryResult.placeholder.spec.ts +44 -0
- package/src/hooks/useQueryResult.ts +26 -1
- package/src/theme/ThemeContext.tsx +21 -1
- package/src/theme/classes.ts +52 -0
- package/src/theme/index.ts +8 -0
- package/src/theme/resolveTheme.ts +3 -0
- package/src/theme/types.ts +7 -0
- package/src/theme/ui.spec.tsx +91 -0
- package/src/theme/ui.ts +115 -0
- package/dist/RenderedResult-BcgYjkZ0.cjs.js +0 -153
- package/dist/ServerProvider-B0dUY8be.cjs.js +0 -1
- package/dist/components/Notebook/cellKind.d.ts +0 -20
- package/dist/components/Report/LinearReport.d.ts +0 -18
- package/dist/components/ReportBuilder/SourceViewPicker.d.ts +0 -9
- package/dist/components/ReportBuilder/legacyNotebook.d.ts +0 -73
- package/dist/components/ReportBuilder/useConversionConfirm.d.ts +0 -20
- package/dist/useCompiledDocument-UY28ITET.cjs.js +0 -141
- package/src/components/Notebook/cellKind.spec.ts +0 -199
- package/src/components/Notebook/cellKind.ts +0 -74
- package/src/components/Report/LinearReport.tsx +0 -71
- package/src/components/ReportBuilder/SourceViewPicker.tsx +0 -122
- package/src/components/ReportBuilder/legacyNotebook.chart.spec.ts +0 -77
- package/src/components/ReportBuilder/legacyNotebook.convert.spec.ts +0 -626
- package/src/components/ReportBuilder/legacyNotebook.read.spec.ts +0 -338
- package/src/components/ReportBuilder/legacyNotebook.ts +0 -1122
- package/src/components/ReportBuilder/useConversionConfirm.ts +0 -55
- package/src/components/legacy/Notebook.served.spec.tsx +0 -183
- /package/dist/components/{Notebook → legacy/malloynb}/runPlan.d.ts +0 -0
- /package/src/components/{Notebook → legacy/malloynb}/runPlan.spec.ts +0 -0
- /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
|
-
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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=
|
|
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
|
-
|
|
277
|
-
|
|
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: "
|
|
300
|
-
height: "
|
|
301
|
-
|
|
302
|
-
|
|
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: `-${
|
|
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
|
|
350
|
-
|
|
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
|
-
|
|
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
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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: `${-
|
|
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
|
-
|
|
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
|
|
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:
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
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
|
-
|
|
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
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
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
|
))}
|