@marimo-team/frontend 0.22.1-dev7 → 0.22.1-dev9
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/assets/{ConnectedDataExplorerComponent-BhOfvmd2.js → ConnectedDataExplorerComponent-Bgd8MpO7.js} +1 -1
- package/dist/assets/{JsonOutput-DiKJplwR.js → JsonOutput-B5gVaor1.js} +1 -1
- package/dist/assets/{add-connection-dialog-BG5MyoeX.js → add-connection-dialog-rcpXb2Qg.js} +1 -1
- package/dist/assets/{agent-panel-CND7C-iU.js → agent-panel-DV6YglYM.js} +1 -1
- package/dist/assets/{cell-editor-CwiMG3ec.js → cell-editor-DGdVSm8g.js} +1 -1
- package/dist/assets/{column-preview-DuaRRihv.js → column-preview-DzVgkEwb.js} +1 -1
- package/dist/assets/{command-palette-rRLuA_TQ.js → command-palette-jsUKdXe9.js} +1 -1
- package/dist/assets/{edit-page-DlOE_eNk.js → edit-page-BtbZ-agq.js} +3 -3
- package/dist/assets/{file-explorer-panel-xbl6tMMi.js → file-explorer-panel-Dj5UWchN.js} +1 -1
- package/dist/assets/{form-BQ3vTb1b.js → form-B20VRSP2.js} +1 -1
- package/dist/assets/{formats-C_TavbEL.js → formats-N7VZhahg.js} +1 -1
- package/dist/assets/{hooks-BYhfK27L.js → hooks-CdA_QjCf.js} +1 -1
- package/dist/assets/{index-qjvWzbH2.css → index-CEEbZ31_.css} +1 -1
- package/dist/assets/{index-BABbKUpv.js → index-D4Ti6NeW.js} +5 -5
- package/dist/assets/{layout-Dzf_yrNt.js → layout-Cj6tuX2_.js} +1 -1
- package/dist/assets/{panels-UI7aIWgn.js → panels--RsDtdC1.js} +1 -1
- package/dist/assets/{run-page-v-1BqfNl.js → run-page-Burco7cL.js} +1 -1
- package/dist/assets/{scratchpad-panel-CHxQ_DzV.js → scratchpad-panel-CJhjbe49.js} +1 -1
- package/dist/assets/{session-panel-ClRl_dNb.js → session-panel-CuDkoD_I.js} +1 -1
- package/dist/assets/{state-CW8RjcVC.js → state-CUXzbab2.js} +1 -1
- package/dist/assets/{useNotebookActions--HXlwpwM.js → useNotebookActions-hwrgEm82.js} +1 -1
- package/dist/assets/{utils-BDlGlVyF.js → utils-DWFl4LEP.js} +3 -3
- package/dist/assets/{vega-component-DiFt6ZG4.js → vega-component-BAuy1PqH.js} +1 -1
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/src/plugins/impl/vega/__tests__/utils.test.ts +68 -0
- package/src/plugins/impl/vega/utils.ts +14 -5
- package/src/plugins/impl/vega/vega.css +2 -1
|
@@ -6,13 +6,22 @@ import type { DataType, FieldTypes, VegaDataType } from "./vega-loader";
|
|
|
6
6
|
export type ContainerWidth = number | "container";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Get the container width from a
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Get the container width from a Vega-Lite spec.
|
|
10
|
+
*
|
|
11
|
+
* For unit specs, `width` is at the top level. For facet/repeat specs,
|
|
12
|
+
* `width` is nested inside `spec`. This does not handle hconcat/vconcat and Vega spec
|
|
13
|
+
* where the width may be a signal. These cases are covered by
|
|
14
|
+
* the CSS fallback `.vega-embed:has(> .chart-wrapper.fit-x)`.
|
|
12
15
|
*/
|
|
13
16
|
export function getContainerWidth(spec: unknown): ContainerWidth | undefined {
|
|
14
|
-
if (typeof spec === "object" && spec !== null
|
|
15
|
-
|
|
17
|
+
if (typeof spec === "object" && spec !== null) {
|
|
18
|
+
if ("width" in spec) {
|
|
19
|
+
return spec.width as ContainerWidth | undefined;
|
|
20
|
+
}
|
|
21
|
+
// Faceted/repeated spec
|
|
22
|
+
if ("spec" in spec) {
|
|
23
|
+
return getContainerWidth(spec.spec);
|
|
24
|
+
}
|
|
16
25
|
}
|
|
17
26
|
return undefined;
|
|
18
27
|
}
|