@malloy-publisher/sdk 0.9.1 → 0.9.3
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-BRgIgxWh.es.js → RenderedResult-DwB0-9Yx.es.js} +219 -210
- package/dist/RenderedResult-hKjFEqaN.cjs.js +141 -0
- package/dist/{ServerProvider-Boxrv6Ym.es.js → ServerProvider-CcSrGaRN.es.js} +1473 -1326
- package/dist/ServerProvider-Gbf1YPOP.cjs.js +1 -0
- package/dist/builder/index.cjs.js +143 -58
- package/dist/builder/index.es.js +12179 -9318
- package/dist/builder-entry.d.ts +5 -1
- package/dist/client/api.d.ts +247 -56
- package/dist/client/configuration.d.ts +1 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.es.js +94 -88
- package/dist/client-entry.d.ts +2 -0
- package/dist/components/ApiErrorDisplay.d.ts +11 -0
- package/dist/components/AppDialog.d.ts +6 -6
- package/dist/components/Dashboard/Dashboard.d.ts +8 -15
- package/dist/components/Dashboard/DashboardGrid.d.ts +38 -6
- package/dist/components/Dashboard/DashboardTile.d.ts +21 -2
- package/dist/components/Dashboard/DashboardView.d.ts +71 -0
- package/dist/components/Dashboard/TileCard.d.ts +30 -5
- package/dist/components/Dashboard/TileFilterTag.d.ts +12 -0
- package/dist/components/Dashboard/dropValueUrlTags.d.ts +6 -0
- package/dist/components/Dashboard/index.d.ts +5 -1
- package/dist/components/Dashboard/telemetry.d.ts +16 -3
- package/dist/components/Dashboard/textSource.d.ts +19 -0
- package/dist/components/DashboardBuilder/AddTileDialog.d.ts +15 -9
- package/dist/components/DashboardBuilder/BuilderDialogs.d.ts +25 -0
- package/dist/components/DashboardBuilder/BuilderGrid.d.ts +31 -0
- package/dist/components/DashboardBuilder/BuilderHeader.d.ts +17 -0
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +23 -15
- package/dist/components/DashboardBuilder/ChartPicker.d.ts +31 -0
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +56 -21
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +44 -5
- package/dist/components/DashboardBuilder/EditorSurface.d.ts +33 -0
- package/dist/components/DashboardBuilder/FilterDialog.d.ts +2 -2
- package/dist/components/DashboardBuilder/FilterStrip.d.ts +8 -4
- package/dist/components/DashboardBuilder/InlineMarkdown.d.ts +18 -0
- package/dist/components/DashboardBuilder/InlineText.d.ts +19 -0
- package/dist/components/DashboardBuilder/NotebookEditor.d.ts +15 -0
- package/dist/components/DashboardBuilder/SourceViewPicker.d.ts +9 -0
- package/dist/components/DashboardBuilder/TextTileBody.d.ts +10 -0
- package/dist/components/DashboardBuilder/TileFrame.d.ts +51 -12
- package/dist/components/DashboardBuilder/TileMenu.d.ts +12 -6
- package/dist/components/DashboardBuilder/annotationText.d.ts +4 -0
- package/dist/components/DashboardBuilder/builderReport.d.ts +13 -0
- package/dist/components/DashboardBuilder/catalog.d.ts +4 -18
- package/dist/components/DashboardBuilder/changedTile.d.ts +7 -0
- package/dist/components/DashboardBuilder/chartLine.d.ts +33 -0
- package/dist/components/DashboardBuilder/controls.d.ts +2 -2
- package/dist/components/DashboardBuilder/document.d.ts +42 -26
- package/dist/components/DashboardBuilder/documentSession.d.ts +100 -0
- package/dist/components/DashboardBuilder/imports.d.ts +19 -0
- package/dist/components/DashboardBuilder/inlineEdit.d.ts +18 -0
- package/dist/components/DashboardBuilder/legacyNotebook.d.ts +73 -0
- package/dist/components/DashboardBuilder/loadMalloy.d.ts +15 -0
- package/dist/components/DashboardBuilder/malloyTree.d.ts +119 -0
- package/dist/components/DashboardBuilder/newDashboard.d.ts +3 -1
- package/dist/components/DashboardBuilder/openDraft.d.ts +10 -0
- package/dist/components/DashboardBuilder/preview.d.ts +24 -4
- package/dist/components/DashboardBuilder/readDocument.d.ts +6 -1
- package/dist/components/DashboardBuilder/readForEditor.d.ts +16 -0
- package/dist/components/DashboardBuilder/sortable.d.ts +16 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +15 -13
- package/dist/components/DashboardBuilder/spliceResult.d.ts +11 -0
- package/dist/components/DashboardBuilder/tagParse.d.ts +24 -0
- package/dist/components/DashboardBuilder/telemetry.d.ts +43 -0
- package/dist/components/DashboardBuilder/testing/fixtures.d.ts +3 -1
- package/dist/components/DashboardBuilder/testing/inline.d.ts +4 -0
- package/dist/components/DashboardBuilder/testing/resize.d.ts +7 -0
- package/dist/components/DashboardBuilder/tileDisplayTitle.d.ts +7 -0
- package/dist/components/DashboardBuilder/useBuilderSelection.d.ts +53 -0
- package/dist/components/DashboardBuilder/useBuilderSession.d.ts +86 -0
- package/dist/components/DashboardBuilder/useBuilderShortcuts.d.ts +9 -6
- package/dist/components/DashboardBuilder/useControlBindings.d.ts +30 -0
- package/dist/components/DashboardBuilder/useConversionConfirm.d.ts +20 -0
- package/dist/components/DashboardBuilder/useDashboardEditor.d.ts +19 -55
- package/dist/components/DashboardBuilder/useDocumentEditor.d.ts +105 -0
- package/dist/components/DashboardBuilder/useDraft.d.ts +3 -1
- package/dist/components/DashboardBuilder/useExitGuard.d.ts +19 -0
- package/dist/components/DashboardBuilder/useFilterForm.d.ts +3 -3
- package/dist/components/DashboardBuilder/useHostCopy.d.ts +26 -0
- package/dist/components/DashboardBuilder/useOpenDraftCommit.d.ts +17 -0
- package/dist/components/DashboardBuilder/useOpenedDocument.d.ts +71 -0
- package/dist/components/DashboardBuilder/useSaveChannel.d.ts +50 -0
- package/dist/components/DashboardBuilder/useTileEditing.d.ts +33 -0
- package/dist/components/DashboardBuilder/useTileResize.d.ts +6 -3
- package/dist/components/DocumentCreate/canRetry.d.ts +6 -0
- package/dist/components/DocumentCreate/createDocument.d.ts +58 -0
- package/dist/components/DocumentCreate/documentPath.d.ts +10 -0
- package/dist/components/DocumentCreate/events.d.ts +10 -0
- package/dist/components/DocumentCreate/exportedSources.d.ts +7 -0
- package/dist/components/DocumentCreate/guards.d.ts +12 -0
- package/dist/components/DocumentCreate/index.d.ts +6 -0
- package/dist/components/DocumentCreate/newNotebook.d.ts +9 -0
- package/dist/components/DocumentCreate/useDocumentChoices.d.ts +32 -0
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +2 -1
- package/dist/components/Loading.d.ts +13 -0
- package/dist/components/NarrowEditGate.d.ts +8 -0
- package/dist/components/Notebook/Notebook.d.ts +1 -1
- package/dist/components/Notebook/NotebookCell.d.ts +1 -5
- package/dist/components/Package/NewDocumentDialog.d.ts +33 -0
- package/dist/components/Package/Package.d.ts +17 -1
- package/dist/components/Package/documentLocation.d.ts +28 -0
- package/dist/components/Package/index.d.ts +5 -1
- package/dist/components/Package/useDocumentLocation.d.ts +12 -0
- package/dist/components/PackageSection.d.ts +2 -2
- package/dist/components/Prose.d.ts +1 -1
- package/dist/components/RenderedResult/RenderedResult.d.ts +2 -0
- package/dist/components/RenderedResult/ResultContainer.d.ts +8 -1
- package/dist/components/RenderedResult/ResultPanel.d.ts +3 -1
- package/dist/components/RenderedResult/loadRenderer.d.ts +7 -0
- package/dist/components/RenderedResult/resultSizing.d.ts +9 -1
- package/dist/components/ServerProvider.d.ts +2 -1
- package/dist/components/UnsavedChangesDialog.d.ts +9 -0
- package/dist/components/given/GivensPanel.d.ts +2 -2
- package/dist/components/given/paramCodec.d.ts +8 -1
- package/dist/components/index.d.ts +3 -2
- package/dist/components/styles.d.ts +4 -4
- package/dist/hooks/givenValue.d.ts +6 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useCompiledDocument.d.ts +23 -0
- package/dist/hooks/useDocumentControls.d.ts +6 -1
- package/dist/hooks/useNarrowScreen.d.ts +4 -0
- package/dist/hooks/useNearViewport.d.ts +16 -0
- package/dist/hooks/useQueryResult.d.ts +2 -0
- package/dist/hooks/useQueryWithApiError.d.ts +7 -2
- package/dist/hooks/useSettled.d.ts +14 -0
- package/dist/hooks/useSuggestOptions.d.ts +9 -2
- package/dist/index.cjs.js +23 -24
- package/dist/index.es.js +9041 -7002
- package/dist/text/index.cjs.js +1 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.es.js +6 -0
- package/dist/text-entry-BJwltZiy.cjs.js +7 -0
- package/dist/text-entry-CA0LZ1xL.es.js +196 -0
- package/dist/text-entry.d.ts +2 -0
- package/dist/theme/accent.d.ts +29 -0
- package/dist/theme/buildVegaThemeOverride.d.ts +3 -3
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/keys.d.ts +1 -1
- package/dist/theme/motion.d.ts +31 -0
- package/dist/theme/readChartAnnotations.d.ts +1 -1
- package/dist/theme/resolveTheme.d.ts +4 -4
- package/dist/theme/types.d.ts +33 -5
- package/dist/{Dashboard-H1kJlDFo.es.js → useCompiledDocument-BU6d8FPp.es.js} +17904 -19057
- package/dist/useCompiledDocument-pOg2W-Yt.cjs.js +142 -0
- package/dist/utils/clock.d.ts +2 -0
- package/dist/utils/malloyText.d.ts +104 -0
- package/package.json +20 -11
- package/src/builder-entry.ts +36 -0
- package/src/client-entry.ts +8 -0
- package/src/clientEntry.spec.ts +17 -0
- package/src/components/ApiErrorDisplay.tsx +37 -18
- package/src/components/AppDialog.tsx +8 -7
- package/src/components/Dashboard/Dashboard.spec.tsx +3 -32
- package/src/components/Dashboard/Dashboard.tsx +29 -280
- package/src/components/Dashboard/DashboardGrid.tsx +87 -8
- package/src/components/Dashboard/DashboardTile.spec.tsx +121 -2
- package/src/components/Dashboard/DashboardTile.tsx +121 -30
- package/src/components/Dashboard/DashboardView.spec.tsx +368 -0
- package/src/components/Dashboard/DashboardView.tsx +428 -0
- package/src/components/Dashboard/RowsDialog.tsx +4 -3
- package/src/components/Dashboard/TileCard.tsx +60 -11
- package/src/components/Dashboard/TileFilterTag.spec.tsx +73 -0
- package/src/components/Dashboard/TileFilterTag.tsx +78 -0
- package/src/components/Dashboard/defaultTileSpan.spec.ts +32 -0
- package/src/components/Dashboard/dropValueUrlTags.spec.ts +177 -0
- package/src/components/Dashboard/dropValueUrlTags.ts +108 -0
- package/src/components/Dashboard/index.ts +13 -1
- package/src/components/Dashboard/telemetry.ts +17 -5
- package/src/components/Dashboard/textSource.spec.ts +36 -0
- package/src/components/Dashboard/textSource.ts +39 -0
- package/src/components/DashboardBuilder/AddTileDialog.spec.tsx +88 -0
- package/src/components/DashboardBuilder/AddTileDialog.tsx +124 -138
- package/src/components/DashboardBuilder/BuilderDialogs.tsx +162 -0
- package/src/components/DashboardBuilder/BuilderGrid.tsx +245 -0
- package/src/components/DashboardBuilder/BuilderHeader.tsx +107 -0
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +111 -80
- package/src/components/DashboardBuilder/ChartPicker.render.spec.tsx +25 -0
- package/src/components/DashboardBuilder/ChartPicker.spec.ts +77 -0
- package/src/components/DashboardBuilder/ChartPicker.tsx +156 -0
- package/src/components/DashboardBuilder/DashboardBuilder.charts.spec.tsx +205 -0
- package/src/components/DashboardBuilder/DashboardBuilder.exit.spec.tsx +183 -0
- package/src/components/DashboardBuilder/DashboardBuilder.inline.spec.tsx +373 -0
- package/src/components/DashboardBuilder/DashboardBuilder.notebook.spec.tsx +310 -0
- package/src/components/DashboardBuilder/DashboardBuilder.openDraft.spec.tsx +105 -0
- package/src/components/DashboardBuilder/DashboardBuilder.sources.spec.tsx +117 -0
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +146 -108
- package/src/components/DashboardBuilder/DashboardBuilder.textTiles.spec.tsx +179 -0
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +330 -512
- package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +55 -25
- package/src/components/DashboardBuilder/DashboardEditor.emptyStart.spec.tsx +142 -0
- package/src/components/DashboardBuilder/DashboardEditor.filterTag.spec.tsx +162 -0
- package/src/components/DashboardBuilder/DashboardEditor.notebook.spec.tsx +310 -0
- package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +39 -13
- package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +9 -26
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +102 -25
- package/src/components/DashboardBuilder/DashboardEditor.textSource.spec.tsx +317 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +252 -780
- package/src/components/DashboardBuilder/DrillDialog.tsx +2 -2
- package/src/components/DashboardBuilder/EditorSurface.tsx +471 -0
- package/src/components/DashboardBuilder/FilterDialog.tsx +23 -11
- package/src/components/DashboardBuilder/FilterStrip.tsx +130 -70
- package/src/components/DashboardBuilder/InlineMarkdown.tsx +182 -0
- package/src/components/DashboardBuilder/InlineText.tsx +112 -0
- package/src/components/DashboardBuilder/NotebookEditor.tsx +44 -0
- package/src/components/DashboardBuilder/SourceViewPicker.tsx +122 -0
- package/src/components/DashboardBuilder/TextTileBody.tsx +31 -0
- package/src/components/DashboardBuilder/TileFrame.tsx +302 -163
- package/src/components/DashboardBuilder/TileMenu.tsx +125 -97
- package/src/components/DashboardBuilder/annotationText.spec.ts +33 -0
- package/src/components/DashboardBuilder/annotationText.ts +17 -0
- package/src/components/DashboardBuilder/artifactBlock.spec.ts +248 -0
- package/src/components/DashboardBuilder/artifactTagParity.spec.ts +46 -0
- package/src/components/DashboardBuilder/builderReport.ts +74 -0
- package/src/components/DashboardBuilder/catalog.aggregate.spec.ts +49 -0
- package/src/components/DashboardBuilder/catalog.spec.ts +2 -44
- package/src/components/DashboardBuilder/catalog.ts +61 -57
- package/src/components/DashboardBuilder/changedTile.spec.ts +46 -0
- package/src/components/DashboardBuilder/changedTile.ts +28 -0
- package/src/components/DashboardBuilder/chartLine.spec.ts +180 -0
- package/src/components/DashboardBuilder/chartLine.ts +121 -0
- package/src/components/DashboardBuilder/controls.spec.ts +21 -10
- package/src/components/DashboardBuilder/controls.ts +22 -8
- package/src/components/DashboardBuilder/document.ts +53 -5
- package/src/components/DashboardBuilder/documentSession.spec.ts +209 -0
- package/src/components/DashboardBuilder/documentSession.ts +258 -0
- package/src/components/DashboardBuilder/emptyStart.spec.ts +131 -0
- package/src/components/DashboardBuilder/imports.spec.ts +61 -0
- package/src/components/DashboardBuilder/imports.ts +93 -0
- package/src/components/DashboardBuilder/inlineEdit.tsx +78 -0
- package/src/components/DashboardBuilder/invariants.spec.ts +6 -2
- package/src/components/DashboardBuilder/legacyNotebook.chart.spec.ts +77 -0
- package/src/components/DashboardBuilder/legacyNotebook.convert.spec.ts +630 -0
- package/src/components/DashboardBuilder/legacyNotebook.read.spec.ts +338 -0
- package/src/components/DashboardBuilder/legacyNotebook.ts +1117 -0
- package/src/components/DashboardBuilder/loadMalloy.spec.ts +80 -0
- package/src/components/DashboardBuilder/loadMalloy.ts +39 -0
- package/src/components/DashboardBuilder/malloyTree.ts +159 -7
- package/src/components/DashboardBuilder/newDashboard.spec.ts +46 -2
- package/src/components/DashboardBuilder/newDashboard.ts +30 -3
- package/src/components/DashboardBuilder/openDraft.ts +52 -0
- package/src/components/DashboardBuilder/preview.shapes.spec.ts +75 -0
- package/src/components/DashboardBuilder/preview.spec.ts +159 -12
- package/src/components/DashboardBuilder/preview.ts +83 -9
- package/src/components/DashboardBuilder/readDocument.spec.ts +174 -26
- package/src/components/DashboardBuilder/readDocument.ts +137 -45
- package/src/components/DashboardBuilder/readForEditor.spec.ts +80 -0
- package/src/components/DashboardBuilder/readForEditor.ts +52 -0
- package/src/components/DashboardBuilder/scannerShapes.spec.ts +14 -13
- package/src/components/DashboardBuilder/sortable.spec.ts +89 -0
- package/src/components/DashboardBuilder/sortable.tsx +11 -10
- package/src/components/DashboardBuilder/spliceDocument.chart.spec.ts +340 -0
- package/src/components/DashboardBuilder/spliceDocument.imports.spec.ts +167 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +229 -94
- package/src/components/DashboardBuilder/spliceDocument.ts +768 -131
- package/src/components/DashboardBuilder/spliceResult.ts +15 -0
- package/src/components/DashboardBuilder/statementExtent.spec.ts +33 -30
- package/src/components/DashboardBuilder/tagParse.spec.ts +149 -0
- package/src/components/DashboardBuilder/tagParse.ts +103 -0
- package/src/components/DashboardBuilder/telemetry.ts +47 -0
- package/src/components/DashboardBuilder/testing/artifactTagParity.json +253 -0
- package/src/components/DashboardBuilder/testing/documentKindRule.json +40 -0
- package/src/components/DashboardBuilder/testing/fixtures.ts +16 -1
- package/src/components/DashboardBuilder/testing/inline.ts +25 -0
- package/src/components/DashboardBuilder/testing/resize.ts +48 -0
- package/src/components/DashboardBuilder/testing/urlRenderTags.json +62 -0
- package/src/components/DashboardBuilder/textTiles.spec.ts +760 -0
- package/src/components/DashboardBuilder/tileDisplayTitle.ts +13 -0
- package/src/components/DashboardBuilder/useBuilderSelection.ts +121 -0
- package/src/components/DashboardBuilder/useBuilderSession.spec.ts +250 -0
- package/src/components/DashboardBuilder/useBuilderSession.ts +255 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.overlay.spec.tsx +97 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.spec.tsx +60 -0
- package/src/components/DashboardBuilder/useBuilderShortcuts.ts +45 -9
- package/src/components/DashboardBuilder/useControlBindings.ts +152 -0
- package/src/components/DashboardBuilder/useConversionConfirm.ts +55 -0
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +16 -13
- package/src/components/DashboardBuilder/useDashboardEditor.ts +57 -181
- package/src/components/DashboardBuilder/useDocumentEditor.spec.ts +565 -0
- package/src/components/DashboardBuilder/useDocumentEditor.ts +399 -0
- package/src/components/DashboardBuilder/useDraft.ts +15 -2
- package/src/components/DashboardBuilder/useExitGuard.spec.ts +159 -0
- package/src/components/DashboardBuilder/useExitGuard.ts +89 -0
- package/src/components/DashboardBuilder/useFilterForm.existing.spec.tsx +41 -0
- package/src/components/DashboardBuilder/useFilterForm.spec.tsx +24 -2
- package/src/components/DashboardBuilder/useFilterForm.ts +41 -13
- package/src/components/DashboardBuilder/useHostCopy.ts +104 -0
- package/src/components/DashboardBuilder/useOpenDraftCommit.ts +47 -0
- package/src/components/DashboardBuilder/useOpenedDocument.ts +314 -0
- package/src/components/DashboardBuilder/useSaveChannel.ts +275 -0
- package/src/components/DashboardBuilder/useTileEditing.ts +141 -0
- package/src/components/DashboardBuilder/useTileReorder.spec.tsx +28 -5
- package/src/components/DashboardBuilder/useTileReorder.ts +5 -7
- package/src/components/DashboardBuilder/useTileResize.spec.tsx +30 -5
- package/src/components/DashboardBuilder/useTileResize.ts +31 -8
- package/src/components/DataAppViewer/DataAppViewer.tsx +7 -4
- package/src/components/DocumentCreate/canRetry.spec.ts +32 -0
- package/src/components/DocumentCreate/canRetry.ts +19 -0
- package/src/components/DocumentCreate/createDocument.spec.ts +310 -0
- package/src/components/DocumentCreate/createDocument.ts +159 -0
- package/src/components/DocumentCreate/documentPath.ts +40 -0
- package/src/components/DocumentCreate/events.ts +15 -0
- package/src/components/DocumentCreate/exportedSources.ts +25 -0
- package/src/components/DocumentCreate/guards.ts +45 -0
- package/src/components/DocumentCreate/index.ts +27 -0
- package/src/components/DocumentCreate/newNotebook.spec.ts +156 -0
- package/src/components/DocumentCreate/newNotebook.ts +44 -0
- package/src/components/DocumentCreate/useDocumentChoices.spec.tsx +138 -0
- package/src/components/DocumentCreate/useDocumentChoices.ts +113 -0
- package/src/components/DocumentStorage/DocumentStorage.ts +2 -1
- package/src/components/Environment/Environment.tsx +0 -10
- package/src/components/Loading.tsx +14 -0
- package/src/components/Model/Model.tsx +16 -9
- package/src/components/Model/ModelExplorer.spec.tsx +2 -2
- package/src/components/Model/ModelExplorer.tsx +2 -2
- package/src/components/Model/SourcesExplorer.tsx +2 -4
- package/src/components/NarrowEditGate.spec.tsx +73 -0
- package/src/components/NarrowEditGate.tsx +29 -0
- package/src/components/Notebook/Notebook.layout.spec.tsx +94 -0
- package/src/components/Notebook/Notebook.tsx +72 -29
- package/src/components/Notebook/NotebookCell.tsx +90 -215
- package/src/components/Package/NewDocumentDialog.spec.tsx +749 -0
- package/src/components/Package/NewDocumentDialog.tsx +401 -0
- package/src/components/Package/Package.artifacts.spec.tsx +186 -0
- package/src/components/Package/Package.create.spec.tsx +401 -0
- package/src/components/Package/Package.notebooks.spec.tsx +18 -0
- package/src/components/Package/Package.tsx +396 -177
- package/src/components/Package/documentLocation.spec.ts +81 -0
- package/src/components/Package/documentLocation.ts +55 -0
- package/src/components/Package/index.ts +14 -1
- package/src/components/Package/useDocumentLocation.ts +59 -0
- package/src/components/PackageSection.tsx +2 -2
- package/src/components/Prose.spec.tsx +37 -0
- package/src/components/Prose.tsx +35 -5
- package/src/components/RenderedResult/RenderedResult.tsx +23 -8
- package/src/components/RenderedResult/ResultContainer.tsx +51 -13
- package/src/components/RenderedResult/ResultPanel.tsx +24 -5
- package/src/components/RenderedResult/loadRenderer.ts +42 -0
- package/src/components/RenderedResult/resultSizing.spec.ts +68 -0
- package/src/components/RenderedResult/resultSizing.ts +14 -3
- package/src/components/ServerProvider.tsx +2 -1
- package/src/components/UnsavedChangesDialog.spec.tsx +70 -0
- package/src/components/UnsavedChangesDialog.tsx +49 -0
- package/src/components/given/GivenInput.spec.tsx +5 -5
- package/src/components/given/GivenInput.tsx +46 -38
- package/src/components/given/GivensPanel.spec.tsx +6 -6
- package/src/components/given/GivensPanel.tsx +5 -11
- package/src/components/given/paramCodec.ts +27 -1
- package/src/components/index.ts +3 -2
- package/src/components/styles.ts +4 -5
- package/src/hooks/givenValue.ts +9 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useCompiledDocument.spec.tsx +86 -0
- package/src/hooks/useCompiledDocument.ts +59 -0
- package/src/hooks/useDimensionalFilterRangeData.ts +3 -1
- package/src/hooks/useDocumentControls.ts +13 -1
- package/src/hooks/useNarrowScreen.ts +21 -0
- package/src/hooks/useNearViewport.spec.tsx +150 -0
- package/src/hooks/useNearViewport.ts +102 -0
- package/src/hooks/useQueryResult.ts +23 -1
- package/src/hooks/useQueryWithApiError.ts +10 -3
- package/src/hooks/useRawQueryData.ts +3 -1
- package/src/hooks/useSettled.spec.ts +41 -0
- package/src/hooks/useSettled.ts +27 -0
- package/src/hooks/useSuggestOptions.dom.spec.ts +40 -1
- package/src/hooks/useSuggestOptions.ts +42 -10
- package/src/mainEntry.spec.ts +145 -0
- package/src/text-entry.ts +12 -0
- package/src/textEntry.spec.ts +112 -0
- package/src/theme/accent.spec.ts +116 -0
- package/src/theme/accent.ts +148 -0
- package/src/theme/buildTableCssVars.spec.ts +24 -0
- package/src/theme/buildTableCssVars.ts +1 -2
- package/src/theme/buildVegaThemeOverride.spec.ts +38 -2
- package/src/theme/buildVegaThemeOverride.ts +5 -5
- package/src/theme/defaults.ts +34 -0
- package/src/theme/index.ts +9 -0
- package/src/theme/keys.ts +6 -0
- package/src/theme/motion.ts +44 -0
- package/src/theme/readChartAnnotations.spec.ts +18 -0
- package/src/theme/readChartAnnotations.ts +1 -1
- package/src/theme/resolveTheme.spec.ts +73 -0
- package/src/theme/resolveTheme.ts +61 -20
- package/src/theme/types.ts +30 -5
- package/src/utils/clock.spec.ts +12 -0
- package/src/utils/clock.ts +6 -0
- package/src/{components/DashboardBuilder → utils}/malloyText.spec.ts +48 -0
- package/src/utils/malloyText.ts +368 -0
- package/src/utils/queryClient.ts +8 -0
- package/vite.config.ts +4 -0
- package/dist/Dashboard-ChyylkTD.cjs.js +0 -136
- package/dist/RenderedResult-AJPMUkAD.cjs.js +0 -135
- package/dist/ServerProvider-CXrOKD6g.cjs.js +0 -1
- package/dist/components/Dashboard/DashboardBar.d.ts +0 -21
- package/dist/components/Dashboard/ExploreDialog.d.ts +0 -20
- package/dist/components/DashboardBuilder/DiffDialog.d.ts +0 -15
- package/dist/components/DashboardBuilder/SettingsPopover.d.ts +0 -20
- package/dist/components/DashboardBuilder/diff.d.ts +0 -35
- package/dist/components/DashboardBuilder/malloyText.d.ts +0 -64
- package/dist/components/Package/NewDashboardDialog.d.ts +0 -18
- package/src/components/Dashboard/DashboardBar.tsx +0 -88
- package/src/components/Dashboard/ExploreDialog.tsx +0 -89
- package/src/components/DashboardBuilder/DiffDialog.tsx +0 -122
- package/src/components/DashboardBuilder/SettingsPopover.tsx +0 -168
- package/src/components/DashboardBuilder/diff.spec.ts +0 -44
- package/src/components/DashboardBuilder/diff.ts +0 -93
- package/src/components/DashboardBuilder/malloyText.ts +0 -214
- package/src/components/Package/NewDashboardDialog.spec.tsx +0 -129
- package/src/components/Package/NewDashboardDialog.tsx +0 -265
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Box, IconButton, Typography } from "@mui/material";
|
|
4
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
5
|
+
import { Box, IconButton, SvgIcon, Typography } from "@mui/material";
|
|
7
6
|
import type { PointerEvent, ReactNode } from "react";
|
|
7
|
+
import type { Theme } from "@mui/material";
|
|
8
|
+
import type { SystemStyleObject } from "@mui/system";
|
|
9
|
+
import { MOTION_FAST, reducedMotionSx } from "../../theme/motion";
|
|
8
10
|
import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
11
|
+
import type { ResolvedTheme } from "../../theme/types";
|
|
12
|
+
import {
|
|
13
|
+
BARE_RING_OFFSET_PX,
|
|
14
|
+
GRID_GAP_PX,
|
|
15
|
+
NOTEBOOK_GAP_PX,
|
|
16
|
+
} from "../Dashboard/DashboardGrid";
|
|
17
|
+
import {
|
|
18
|
+
TileCard,
|
|
19
|
+
TileHeading,
|
|
20
|
+
type TileChrome,
|
|
21
|
+
type TileHeadingSlots,
|
|
22
|
+
} from "../Dashboard/TileCard";
|
|
23
|
+
import { tileDisplayTitle } from "./tileDisplayTitle";
|
|
24
|
+
import {
|
|
25
|
+
tileKey,
|
|
26
|
+
tileLabel,
|
|
27
|
+
type DashboardTile,
|
|
28
|
+
type QueryTile,
|
|
29
|
+
} from "./document";
|
|
12
30
|
import { gapId } from "./layout";
|
|
13
|
-
import { GapDroppable, TileSortable } from "./sortable";
|
|
31
|
+
import { GapDroppable, NO_DRAG, TileSortable } from "./sortable";
|
|
14
32
|
|
|
15
33
|
/**
|
|
16
|
-
* Everything the builder draws AROUND a tile: the selection outline, the
|
|
17
|
-
* the
|
|
34
|
+
* Everything the builder draws AROUND a tile: the selection outline, the menu
|
|
35
|
+
* button, the handle at the right edge and, in a notebook, the insert button. The tile
|
|
18
36
|
* itself is `children` — the host's real `DashboardTile`, or a placeholder
|
|
19
37
|
* saying what the tile will run.
|
|
20
38
|
*/
|
|
@@ -22,11 +40,14 @@ export function TileFrame({
|
|
|
22
40
|
tile,
|
|
23
41
|
index,
|
|
24
42
|
selected,
|
|
43
|
+
flash = false,
|
|
25
44
|
menuOpen,
|
|
26
|
-
|
|
27
|
-
|
|
45
|
+
bare = false,
|
|
46
|
+
onInsertAfter,
|
|
28
47
|
onSelect,
|
|
29
48
|
onOpenMenu,
|
|
49
|
+
resizing = false,
|
|
50
|
+
width,
|
|
30
51
|
onResizeStart,
|
|
31
52
|
onResizeMove,
|
|
32
53
|
onResizeEnd,
|
|
@@ -35,22 +56,38 @@ export function TileFrame({
|
|
|
35
56
|
tile: DashboardTile;
|
|
36
57
|
index: number;
|
|
37
58
|
selected: boolean;
|
|
59
|
+
/** Briefly lit: the tile an undo or redo just changed. */
|
|
60
|
+
flash?: boolean;
|
|
38
61
|
/** Whether this tile's menu is open, which keeps its button showing. */
|
|
39
62
|
menuOpen: boolean;
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
63
|
+
/**
|
|
64
|
+
* The tile has no card (a notebook's): its ring is drawn clear of the
|
|
65
|
+
* content and its menu sits on the ring's top edge, so neither touches the
|
|
66
|
+
* text, and the tile reads where the reader draws it.
|
|
67
|
+
*/
|
|
68
|
+
bare?: boolean;
|
|
69
|
+
/** Offers a "+" on the bottom edge that adds a tile after this one; set where tiles stack in one column. */
|
|
70
|
+
onInsertAfter?: () => void;
|
|
43
71
|
onSelect: () => void;
|
|
44
72
|
onOpenMenu: (anchor: HTMLElement) => void;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
73
|
+
/** This tile's edge is being dragged. */
|
|
74
|
+
resizing?: boolean;
|
|
75
|
+
/** Dragging the right edge sets the width; absent, the tile has no edge handle (one column, or tags the file does not own). */
|
|
76
|
+
onResizeStart?: (event: PointerEvent<HTMLDivElement>) => void;
|
|
77
|
+
onResizeMove?: (event: PointerEvent<HTMLDivElement>) => void;
|
|
78
|
+
onResizeEnd?: (event: PointerEvent<HTMLDivElement>) => void;
|
|
79
|
+
/** The tile's width and the grid's, and a step of one column: the edge's keyboard route. */
|
|
80
|
+
width?: {
|
|
81
|
+
span: number;
|
|
82
|
+
columns: number;
|
|
83
|
+
onStep: (to: number) => void;
|
|
84
|
+
};
|
|
48
85
|
children: ReactNode;
|
|
49
86
|
}) {
|
|
50
87
|
const { theme } = usePublisherTheme();
|
|
51
88
|
return (
|
|
52
89
|
<TileSortable id={tileKey(tile)} index={index}>
|
|
53
|
-
{({ ref, handleRef
|
|
90
|
+
{({ ref, handleRef }) => (
|
|
54
91
|
<Box
|
|
55
92
|
ref={ref}
|
|
56
93
|
onClick={onSelect}
|
|
@@ -60,10 +97,18 @@ export function TileFrame({
|
|
|
60
97
|
onPointerDown={(event) => {
|
|
61
98
|
if (event.button === 0) onSelect();
|
|
62
99
|
}}
|
|
100
|
+
// A named group, so the name is announced: a label on a plain
|
|
101
|
+
// element is not.
|
|
102
|
+
role="group"
|
|
63
103
|
aria-label={`Tile ${tile.name}`}
|
|
64
104
|
aria-current={selected}
|
|
105
|
+
// Keyboard focus anywhere in the tile selects it, as a press
|
|
106
|
+
// does, so the arrow-key nudge and the menu follow the keyboard.
|
|
107
|
+
onFocus={onSelect}
|
|
108
|
+
data-tile-key={tileKey(tile)}
|
|
109
|
+
data-flash={flash || undefined}
|
|
65
110
|
sx={{
|
|
66
|
-
// Anchors the
|
|
111
|
+
// Anchors the menu, edge and insert buttons to
|
|
67
112
|
// this tile.
|
|
68
113
|
position: "relative",
|
|
69
114
|
// Same again: this wrapper sits BETWEEN
|
|
@@ -83,20 +128,8 @@ export function TileFrame({
|
|
|
83
128
|
// a scrollbar — still wins over its own
|
|
84
129
|
// pixels.
|
|
85
130
|
cursor: "grab",
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
// outside the tile rather than on it: the
|
|
89
|
-
// tile already has an edge of its own, and
|
|
90
|
-
// an outline neither doubles that edge nor
|
|
91
|
-
// takes up space, so selecting a tile
|
|
92
|
-
// cannot shift the layout being arranged.
|
|
93
|
-
outline: selected
|
|
94
|
-
? `2px solid ${theme.drillLink}`
|
|
95
|
-
: `2px solid transparent`,
|
|
96
|
-
outlineOffset: 2,
|
|
97
|
-
transition:
|
|
98
|
-
"outline-color 120ms, opacity 120ms, box-shadow 120ms",
|
|
99
|
-
// The handles, grip and menu are invisible
|
|
131
|
+
...selectionSx(theme, { selected, flash, bare }),
|
|
132
|
+
// The edge handle and menu are invisible
|
|
100
133
|
// until wanted, and wanted is: the pointer
|
|
101
134
|
// over the tile, or the tile selected. A
|
|
102
135
|
// hover rule on the WRAPPER, so all three
|
|
@@ -118,168 +151,145 @@ export function TileFrame({
|
|
|
118
151
|
"&&[data-dnd-dragging]": {
|
|
119
152
|
opacity: 1,
|
|
120
153
|
outline: "none",
|
|
121
|
-
boxShadow:
|
|
154
|
+
boxShadow: theme.shadow.drag,
|
|
122
155
|
},
|
|
123
156
|
"&&[data-dnd-placeholder]": {
|
|
124
157
|
opacity: 0.45,
|
|
125
|
-
outline: `2px dashed ${theme.
|
|
158
|
+
outline: `2px dashed ${theme.accent}`,
|
|
126
159
|
boxShadow: "none",
|
|
127
160
|
},
|
|
128
161
|
"&:hover .builder-affordance, &:focus-within .builder-affordance":
|
|
129
162
|
{ opacity: 1 },
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// from the ones that will not.
|
|
134
|
-
"&:hover": {
|
|
135
|
-
outlineColor: selected
|
|
136
|
-
? theme.drillLink
|
|
137
|
-
: theme.cardBorder,
|
|
138
|
-
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.10)",
|
|
163
|
+
// No hover on a touch screen: the affordances stand.
|
|
164
|
+
"@media (hover: none)": {
|
|
165
|
+
"& .builder-affordance": { opacity: 1 },
|
|
139
166
|
},
|
|
140
167
|
}}
|
|
141
168
|
>
|
|
142
169
|
{children}
|
|
143
170
|
|
|
144
|
-
{/* The
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
is the sign of it and the library's HANDLE,
|
|
149
|
-
where keyboard focus and the screen-reader
|
|
150
|
-
instructions land: Space picks the tile up,
|
|
151
|
-
the arrows move it, Escape puts it back. */}
|
|
171
|
+
{/* The library's HANDLE, where keyboard focus and the
|
|
172
|
+
screen-reader instructions land: Space picks the tile up, the
|
|
173
|
+
arrows move it, Escape puts it back. Visually hidden: a pointer
|
|
174
|
+
drags the whole card, and the open hand over it says so. */}
|
|
152
175
|
<Box
|
|
153
176
|
ref={handleRef}
|
|
177
|
+
aria-label={`Move ${tileLabel(tile)}`}
|
|
178
|
+
sx={{
|
|
179
|
+
position: "absolute",
|
|
180
|
+
width: "1px",
|
|
181
|
+
height: "1px",
|
|
182
|
+
overflow: "hidden",
|
|
183
|
+
clipPath: "inset(50%)",
|
|
184
|
+
whiteSpace: "nowrap",
|
|
185
|
+
}}
|
|
186
|
+
/>
|
|
187
|
+
|
|
188
|
+
{/* The tile's menu: its chart and drill-through.
|
|
189
|
+
A press here is never the start of a drag: the
|
|
190
|
+
sensor refuses to activate from a button. */}
|
|
191
|
+
<IconButton
|
|
154
192
|
className="builder-affordance"
|
|
155
|
-
|
|
193
|
+
size="small"
|
|
194
|
+
aria-label={`Settings for ${tileLabel(tile)}`}
|
|
195
|
+
onClick={(event) => {
|
|
196
|
+
event.stopPropagation();
|
|
197
|
+
onOpenMenu(event.currentTarget);
|
|
198
|
+
}}
|
|
156
199
|
sx={{
|
|
157
200
|
position: "absolute",
|
|
158
|
-
top
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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,
|
|
167
212
|
zIndex: 2,
|
|
168
213
|
color: theme.tileTitle,
|
|
169
214
|
bgcolor: theme.tile,
|
|
170
|
-
opacity:
|
|
171
|
-
transition:
|
|
172
|
-
|
|
173
|
-
"&:
|
|
174
|
-
"&:focus-visible": {
|
|
215
|
+
opacity: selected || menuOpen ? 0.9 : 0,
|
|
216
|
+
transition: `opacity ${MOTION_FAST}`,
|
|
217
|
+
...reducedMotionSx,
|
|
218
|
+
"&:hover": {
|
|
175
219
|
opacity: 1,
|
|
176
|
-
|
|
177
|
-
outlineOffset: 1,
|
|
220
|
+
bgcolor: theme.tile,
|
|
178
221
|
},
|
|
179
222
|
}}
|
|
180
223
|
>
|
|
181
|
-
<
|
|
182
|
-
</
|
|
183
|
-
|
|
184
|
-
{/* The tile's menu: its title and subtitle.
|
|
185
|
-
Hidden while a resize badge sits in the same
|
|
186
|
-
corner. A press here is never the start of a
|
|
187
|
-
drag: the sensor refuses to activate from a
|
|
188
|
-
button. */}
|
|
189
|
-
{resizeSpan === undefined && (
|
|
190
|
-
<IconButton
|
|
191
|
-
className="builder-affordance"
|
|
192
|
-
size="small"
|
|
193
|
-
aria-label={`Settings for ${tile.label ?? tile.name}`}
|
|
194
|
-
onClick={(event) => {
|
|
195
|
-
event.stopPropagation();
|
|
196
|
-
onOpenMenu(event.currentTarget);
|
|
197
|
-
}}
|
|
198
|
-
sx={{
|
|
199
|
-
position: "absolute",
|
|
200
|
-
top: "2px",
|
|
201
|
-
right: "2px",
|
|
202
|
-
width: 22,
|
|
203
|
-
height: 22,
|
|
204
|
-
zIndex: 2,
|
|
205
|
-
color: theme.tileTitle,
|
|
206
|
-
bgcolor: theme.tile,
|
|
207
|
-
opacity: selected || menuOpen ? 0.9 : 0,
|
|
208
|
-
transition: "opacity 120ms",
|
|
209
|
-
"&:hover": {
|
|
210
|
-
opacity: 1,
|
|
211
|
-
bgcolor: theme.tile,
|
|
212
|
-
},
|
|
213
|
-
}}
|
|
214
|
-
>
|
|
215
|
-
<MoreVertIcon sx={{ fontSize: 16 }} />
|
|
216
|
-
</IconButton>
|
|
217
|
-
)}
|
|
218
|
-
|
|
219
|
-
{/* A tile's width and share of the dashboard,
|
|
220
|
-
reported while you drag it, as the best builders do.
|
|
221
|
-
Height is not ours to show, but the span and
|
|
222
|
-
its share are exactly what a flow grid leaves
|
|
223
|
-
you guessing at. */}
|
|
224
|
-
{resizeSpan !== undefined && (
|
|
225
|
-
<Box
|
|
226
|
-
aria-hidden
|
|
227
|
-
sx={{
|
|
228
|
-
position: "absolute",
|
|
229
|
-
top: "6px",
|
|
230
|
-
right: "6px",
|
|
231
|
-
px: 0.75,
|
|
232
|
-
py: 0.25,
|
|
233
|
-
borderRadius: "4px",
|
|
234
|
-
bgcolor: theme.drillLink,
|
|
235
|
-
color: theme.tile,
|
|
236
|
-
fontSize: 11,
|
|
237
|
-
fontVariantNumeric: "tabular-nums",
|
|
238
|
-
zIndex: 4,
|
|
239
|
-
pointerEvents: "none",
|
|
240
|
-
}}
|
|
241
|
-
>
|
|
242
|
-
{resizeSpan} of {columns} ·{" "}
|
|
243
|
-
{Math.round((resizeSpan / columns) * 100)}%
|
|
244
|
-
</Box>
|
|
245
|
-
)}
|
|
224
|
+
<SpreadDotsIcon />
|
|
225
|
+
</IconButton>
|
|
246
226
|
|
|
247
|
-
{/* The right edge,
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
stops the press reaching the sortable, and
|
|
253
|
-
the sensor refuses a separator regardless. */}
|
|
254
|
-
{tile.declaration.kind !== "inherited" && (
|
|
227
|
+
{/* The right edge, which sets the width: dragged, or focused and
|
|
228
|
+
stepped with the arrow keys a column at a time (Home and End go
|
|
229
|
+
to one column and the full grid). Marked so the move sensor
|
|
230
|
+
never takes a press on it. */}
|
|
231
|
+
{onResizeStart && (
|
|
255
232
|
<Box
|
|
256
233
|
className="builder-affordance"
|
|
234
|
+
{...{ [NO_DRAG]: "" }}
|
|
257
235
|
role="separator"
|
|
236
|
+
tabIndex={width ? 0 : -1}
|
|
258
237
|
aria-orientation="vertical"
|
|
259
|
-
aria-label={`
|
|
238
|
+
aria-label={`Width of ${tileLabel(tile)}`}
|
|
239
|
+
{...(width
|
|
240
|
+
? {
|
|
241
|
+
"aria-valuenow": width.span,
|
|
242
|
+
"aria-valuemin": 1,
|
|
243
|
+
"aria-valuemax": width.columns,
|
|
244
|
+
"aria-valuetext": `${width.span} of ${width.columns} columns`,
|
|
245
|
+
}
|
|
246
|
+
: {})}
|
|
247
|
+
onKeyDown={(event) => {
|
|
248
|
+
if (!width) return;
|
|
249
|
+
const to =
|
|
250
|
+
event.key === "ArrowRight"
|
|
251
|
+
? width.span + 1
|
|
252
|
+
: event.key === "ArrowLeft"
|
|
253
|
+
? width.span - 1
|
|
254
|
+
: event.key === "Home"
|
|
255
|
+
? 1
|
|
256
|
+
: event.key === "End"
|
|
257
|
+
? width.columns
|
|
258
|
+
: undefined;
|
|
259
|
+
if (to === undefined) return;
|
|
260
|
+
// The builder's own arrow-key nudge must not step it again.
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
event.stopPropagation();
|
|
263
|
+
width.onStep(Math.min(Math.max(to, 1), width.columns));
|
|
264
|
+
}}
|
|
260
265
|
onPointerDown={onResizeStart}
|
|
261
266
|
onPointerMove={onResizeMove}
|
|
262
267
|
onPointerUp={onResizeEnd}
|
|
263
268
|
onPointerCancel={onResizeEnd}
|
|
269
|
+
onClick={(event) => event.stopPropagation()}
|
|
264
270
|
sx={{
|
|
265
271
|
position: "absolute",
|
|
266
272
|
top: 0,
|
|
267
273
|
bottom: 0,
|
|
268
|
-
// Straddles the edge, so the target
|
|
269
|
-
//
|
|
270
|
-
// into the tile's content.
|
|
274
|
+
// Straddles the edge, so the target is a usable width
|
|
275
|
+
// without eating into the tile's content.
|
|
271
276
|
right: "-5px",
|
|
272
277
|
width: "10px",
|
|
273
278
|
cursor: "col-resize",
|
|
274
279
|
touchAction: "none",
|
|
275
|
-
zIndex:
|
|
276
|
-
// Invisible until wanted: a rule down
|
|
277
|
-
//
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
transition: "opacity 120ms",
|
|
280
|
+
zIndex: 2,
|
|
281
|
+
// Invisible until wanted: a rule down every tile edge
|
|
282
|
+
// would read as a table.
|
|
283
|
+
opacity: resizing || selected ? 1 : 0,
|
|
284
|
+
transition: `opacity ${MOTION_FAST}`,
|
|
285
|
+
...reducedMotionSx,
|
|
282
286
|
"&:hover": { opacity: 1 },
|
|
287
|
+
"&:focus-visible": {
|
|
288
|
+
opacity: 1,
|
|
289
|
+
outline: `2px solid ${theme.accent}`,
|
|
290
|
+
outlineOffset: 1,
|
|
291
|
+
borderRadius: "3px",
|
|
292
|
+
},
|
|
283
293
|
"&::after": {
|
|
284
294
|
content: '""',
|
|
285
295
|
position: "absolute",
|
|
@@ -289,29 +299,143 @@ export function TileFrame({
|
|
|
289
299
|
width: "4px",
|
|
290
300
|
height: "28px",
|
|
291
301
|
borderRadius: "2px",
|
|
292
|
-
bgcolor: theme.
|
|
302
|
+
bgcolor: theme.accent,
|
|
293
303
|
},
|
|
294
304
|
}}
|
|
295
305
|
/>
|
|
296
306
|
)}
|
|
307
|
+
|
|
308
|
+
{onInsertAfter && (
|
|
309
|
+
<IconButton
|
|
310
|
+
className="builder-affordance"
|
|
311
|
+
size="small"
|
|
312
|
+
aria-label={`Insert tile after ${tileLabel(tile)}`}
|
|
313
|
+
onClick={(event) => {
|
|
314
|
+
event.stopPropagation();
|
|
315
|
+
onInsertAfter();
|
|
316
|
+
}}
|
|
317
|
+
sx={{
|
|
318
|
+
position: "absolute",
|
|
319
|
+
// Centred in the gap below the tile, not on its edge: on
|
|
320
|
+
// a one-line notebook text tile, an edge-centred button
|
|
321
|
+
// covered the middle of the text it sits under.
|
|
322
|
+
bottom: `-${(bare ? NOTEBOOK_GAP_PX : GRID_GAP_PX) / 2 + 12}px`,
|
|
323
|
+
left: "50%",
|
|
324
|
+
transform: "translateX(-50%)",
|
|
325
|
+
width: 24,
|
|
326
|
+
height: 24,
|
|
327
|
+
zIndex: 3,
|
|
328
|
+
color: theme.tileTitle,
|
|
329
|
+
bgcolor: theme.tile,
|
|
330
|
+
border: theme.cardBorder,
|
|
331
|
+
opacity: 0,
|
|
332
|
+
transition: `opacity ${MOTION_FAST}`,
|
|
333
|
+
...reducedMotionSx,
|
|
334
|
+
"&:hover, &:focus-visible": {
|
|
335
|
+
opacity: 1,
|
|
336
|
+
bgcolor: theme.tile,
|
|
337
|
+
},
|
|
338
|
+
}}
|
|
339
|
+
>
|
|
340
|
+
<AddIcon sx={{ fontSize: 14 }} />
|
|
341
|
+
</IconButton>
|
|
342
|
+
)}
|
|
297
343
|
</Box>
|
|
298
344
|
)}
|
|
299
345
|
</TileSortable>
|
|
300
346
|
);
|
|
301
347
|
}
|
|
302
348
|
|
|
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;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* The builder's selection look, for anything a person can select — a tile,
|
|
354
|
+
* the description: an outline outside the element (so selecting moves no
|
|
355
|
+
* layout), solid in the accent when selected, lifting on hover the way a card
|
|
356
|
+
* does in any builder's edit mode, and a brief halo when an undo or redo just
|
|
357
|
+
* changed it. One definition, so the description selects exactly as a tile.
|
|
358
|
+
*/
|
|
359
|
+
export const selectionSx = (
|
|
360
|
+
theme: ResolvedTheme,
|
|
361
|
+
{
|
|
362
|
+
selected,
|
|
363
|
+
flash = false,
|
|
364
|
+
bare = false,
|
|
365
|
+
}: { selected: boolean; flash?: boolean; bare?: boolean },
|
|
366
|
+
): SystemStyleObject<Theme> => {
|
|
367
|
+
const ring = selected || flash ? theme.accent : "transparent";
|
|
368
|
+
const hoverRing = selected
|
|
369
|
+
? theme.accent
|
|
370
|
+
: theme.cardBorder.replace(/^1px solid /, "");
|
|
371
|
+
const transition = `outline-color ${MOTION_FAST}, border-color ${MOTION_FAST}, opacity ${MOTION_FAST}, box-shadow ${MOTION_FAST}`;
|
|
372
|
+
if (bare)
|
|
373
|
+
// Bare content has no padding of its own, so the ring stands off it by
|
|
374
|
+
// the clear space a card's text has, without moving the text from where
|
|
375
|
+
// the reader draws it. Drawn as its own layer rather than an offset
|
|
376
|
+
// outline: an outline's corners grow by the offset, and the ring would
|
|
377
|
+
// read rounder than every card on the page. No lift: there is no
|
|
378
|
+
// surface to lift, only the ring.
|
|
379
|
+
return {
|
|
380
|
+
borderRadius: 1,
|
|
381
|
+
"&::before": {
|
|
382
|
+
content: '""',
|
|
383
|
+
position: "absolute",
|
|
384
|
+
inset: `${-BARE_RING_OFFSET_PX}px`,
|
|
385
|
+
borderRadius: 1,
|
|
386
|
+
border: `2px solid ${ring}`,
|
|
387
|
+
pointerEvents: "none",
|
|
388
|
+
transition,
|
|
389
|
+
...reducedMotionSx,
|
|
390
|
+
},
|
|
391
|
+
"&:hover::before": { borderColor: hoverRing },
|
|
392
|
+
};
|
|
393
|
+
// A card carries its own padding, so its ring hugs its edge.
|
|
394
|
+
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
|
+
}),
|
|
401
|
+
transition,
|
|
402
|
+
...reducedMotionSx,
|
|
403
|
+
"&:hover": {
|
|
404
|
+
outlineColor: hoverRing,
|
|
405
|
+
boxShadow: theme.shadow.lift,
|
|
406
|
+
},
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
|
|
303
410
|
/**
|
|
304
411
|
* No host-supplied tile: say what this one will run, so the surface is still
|
|
305
412
|
* legible without a server.
|
|
306
413
|
*/
|
|
307
|
-
export function TilePlaceholder({
|
|
414
|
+
export function TilePlaceholder({
|
|
415
|
+
tile,
|
|
416
|
+
heading,
|
|
417
|
+
note,
|
|
418
|
+
chrome = "card",
|
|
419
|
+
}: {
|
|
420
|
+
tile: QueryTile;
|
|
421
|
+
heading?: TileHeadingSlots;
|
|
422
|
+
/** Why there is no preview, in place of an empty body. */
|
|
423
|
+
note?: string;
|
|
424
|
+
/** The document's tile chrome, as the reader draws it. */
|
|
425
|
+
chrome?: TileChrome;
|
|
426
|
+
}) {
|
|
308
427
|
const { theme } = usePublisherTheme();
|
|
309
428
|
return (
|
|
310
|
-
<TileCard
|
|
429
|
+
<TileCard chrome={chrome}>
|
|
311
430
|
<TileHeading
|
|
312
|
-
title={
|
|
313
|
-
subtitle={tile.subtitle}
|
|
431
|
+
title={heading?.title ?? tileDisplayTitle(tile)}
|
|
432
|
+
subtitle={heading ? heading.subtitle : tile.subtitle}
|
|
314
433
|
/>
|
|
434
|
+
{note && (
|
|
435
|
+
<Typography variant="body2" sx={{ color: theme.tileTitle, py: 2 }}>
|
|
436
|
+
{note}
|
|
437
|
+
</Typography>
|
|
438
|
+
)}
|
|
315
439
|
<Typography
|
|
316
440
|
variant="caption"
|
|
317
441
|
sx={{ display: "block", color: theme.tileTitle, opacity: 0.7 }}
|
|
@@ -334,17 +458,18 @@ export function GapTarget({ after }: { after: string }) {
|
|
|
334
458
|
sx={{
|
|
335
459
|
minHeight: 48,
|
|
336
460
|
borderRadius: 1,
|
|
337
|
-
border: `1px dashed ${theme.
|
|
461
|
+
border: `1px dashed ${theme.accent}`,
|
|
338
462
|
// Tinted with the same hue as the dashed edge, so the fill
|
|
339
463
|
// and the border read as one affordance lighting up. It was
|
|
340
464
|
// `theme.tile`, the CARD colour, which is the one value
|
|
341
465
|
// guaranteed to match whatever this sits on: a near-no-op
|
|
342
466
|
// before the card went white, and an exact one after.
|
|
343
467
|
bgcolor: isDropTarget
|
|
344
|
-
? `color-mix(in srgb, ${theme.
|
|
468
|
+
? `color-mix(in srgb, ${theme.accent} 12%, transparent)`
|
|
345
469
|
: "transparent",
|
|
346
470
|
opacity: isDropTarget ? 0.95 : 0.4,
|
|
347
|
-
transition:
|
|
471
|
+
transition: `opacity ${MOTION_FAST}, background-color ${MOTION_FAST}`,
|
|
472
|
+
...reducedMotionSx,
|
|
348
473
|
}}
|
|
349
474
|
/>
|
|
350
475
|
)}
|
|
@@ -375,10 +500,10 @@ export function GridGuides({ columns }: { columns: number }) {
|
|
|
375
500
|
<Box
|
|
376
501
|
key={column}
|
|
377
502
|
sx={{
|
|
378
|
-
borderLeft: `1px dashed ${theme.
|
|
503
|
+
borderLeft: `1px dashed ${theme.accent}`,
|
|
379
504
|
borderRight:
|
|
380
505
|
column === columns - 1
|
|
381
|
-
? `1px dashed ${theme.
|
|
506
|
+
? `1px dashed ${theme.accent}`
|
|
382
507
|
: "none",
|
|
383
508
|
opacity: 0.35,
|
|
384
509
|
}}
|
|
@@ -387,3 +512,17 @@ export function GridGuides({ columns }: { columns: number }) {
|
|
|
387
512
|
</Box>
|
|
388
513
|
);
|
|
389
514
|
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* The tile menu's ⋯, with its dots spread wider than the stock icon's so it
|
|
518
|
+
* reads as three dots rather than a dash at this size.
|
|
519
|
+
*/
|
|
520
|
+
function SpreadDotsIcon() {
|
|
521
|
+
return (
|
|
522
|
+
<SvgIcon sx={{ fontSize: 18 }} viewBox="0 0 24 24">
|
|
523
|
+
<circle cx="3.5" cy="12" r="2" />
|
|
524
|
+
<circle cx="12" cy="12" r="2" />
|
|
525
|
+
<circle cx="20.5" cy="12" r="2" />
|
|
526
|
+
</SvgIcon>
|
|
527
|
+
);
|
|
528
|
+
}
|