@marimo-team/frontend 0.24.1-dev41 → 0.24.1-dev42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.24.1-dev41",
3
+ "version": "0.24.1-dev42",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -334,12 +334,10 @@ const PromptArea = memo<PromptAreaProps>(
334
334
  // sentence has to begin with '/' to trigger autocomplete
335
335
  return {
336
336
  triggerCompletionRegex: /^\/(\w+)?/,
337
- completions: commands.map(
338
- (prompt): Completion => ({
339
- label: `/${prompt.name}`,
340
- info: prompt.description,
341
- }),
342
- ),
337
+ completions: commands.map((prompt): Completion => ({
338
+ label: `/${prompt.name}`,
339
+ info: prompt.description,
340
+ })),
343
341
  };
344
342
  }, [commands]);
345
343
 
@@ -196,150 +196,148 @@ export function generateColumns<T>({
196
196
  columnKeys.splice(indexColumnIdx, 1);
197
197
  }
198
198
 
199
- const columns = columnKeys.map(
200
- (key, idx): ColumnDef<T> => ({
201
- id: key || `${NAMELESS_COLUMN_PREFIX}${idx}`,
202
- // Use an accessorFn instead of an accessorKey because column names
203
- // may have periods in them ...
204
- // https://github.com/TanStack/table/issues/1671
205
- accessorFn: (row) => {
206
- return row[key as keyof T];
207
- },
208
- enableHiding: !rowHeadersSet.has(key) && key !== "",
209
- header: ({ column, table }) => {
210
- const stats = chartSpecModel?.getColumnStats(key);
211
- const dtype = column.columnDef.meta?.dtype;
212
- const headerTitle = headerTooltip?.[key];
213
- const headerJustify = textJustifyColumns?.[key];
214
-
215
- const dtypeHeader =
216
- showDataTypes && dtype ? (
217
- <div
218
- className={cn(
219
- "flex flex-row gap-1",
220
- headerJustify === "center" && "justify-center",
221
- headerJustify === "right" && "justify-end",
222
- )}
223
- >
224
- <span className="text-xs text-muted-foreground">{dtype}</span>
225
- {stats && typeof stats.nulls === "number" && stats.nulls > 0 && (
226
- <span className="text-xs text-muted-foreground">
227
- (nulls: {stats.nulls})
228
- </span>
229
- )}
230
- </div>
231
- ) : null;
232
-
233
- const headerName = (
234
- <span
199
+ const columns = columnKeys.map((key, idx): ColumnDef<T> => ({
200
+ id: key || `${NAMELESS_COLUMN_PREFIX}${idx}`,
201
+ // Use an accessorFn instead of an accessorKey because column names
202
+ // may have periods in them ...
203
+ // https://github.com/TanStack/table/issues/1671
204
+ accessorFn: (row) => {
205
+ return row[key as keyof T];
206
+ },
207
+ enableHiding: !rowHeadersSet.has(key) && key !== "",
208
+ header: ({ column, table }) => {
209
+ const stats = chartSpecModel?.getColumnStats(key);
210
+ const dtype = column.columnDef.meta?.dtype;
211
+ const headerTitle = headerTooltip?.[key];
212
+ const headerJustify = textJustifyColumns?.[key];
213
+
214
+ const dtypeHeader =
215
+ showDataTypes && dtype ? (
216
+ <div
235
217
  className={cn(
236
- "font-bold",
237
- headerTitle && "underline decoration-dotted",
218
+ "flex flex-row gap-1",
219
+ headerJustify === "center" && "justify-center",
220
+ headerJustify === "right" && "justify-end",
238
221
  )}
239
222
  >
240
- {key === "" ? " " : key}
241
- </span>
242
- );
223
+ <span className="text-xs text-muted-foreground">{dtype}</span>
224
+ {stats && typeof stats.nulls === "number" && stats.nulls > 0 && (
225
+ <span className="text-xs text-muted-foreground">
226
+ (nulls: {stats.nulls})
227
+ </span>
228
+ )}
229
+ </div>
230
+ ) : null;
243
231
 
244
- const headerWithTooltip = headerTitle ? (
245
- <Tooltip content={headerTitle} delayDuration={300}>
246
- {headerName}
247
- </Tooltip>
248
- ) : (
249
- headerName
250
- );
232
+ const headerName = (
233
+ <span
234
+ className={cn(
235
+ "font-bold",
236
+ headerTitle && "underline decoration-dotted",
237
+ )}
238
+ >
239
+ {key === "" ? " " : key}
240
+ </span>
241
+ );
251
242
 
252
- const dataTableColumnHeader = (
253
- <DataTableColumnHeader
254
- header={headerWithTooltip}
255
- subheader={dtypeHeader}
256
- column={column}
257
- justify={headerJustify}
258
- calculateTopKRows={calculateTopKRows}
259
- table={table}
260
- />
261
- );
243
+ const headerWithTooltip = headerTitle ? (
244
+ <Tooltip content={headerTitle} delayDuration={300}>
245
+ {headerName}
246
+ </Tooltip>
247
+ ) : (
248
+ headerName
249
+ );
262
250
 
263
- // Row headers have no summaries
264
- if (rowHeadersSet.has(key)) {
265
- return dataTableColumnHeader;
266
- }
251
+ const dataTableColumnHeader = (
252
+ <DataTableColumnHeader
253
+ header={headerWithTooltip}
254
+ subheader={dtypeHeader}
255
+ column={column}
256
+ justify={headerJustify}
257
+ calculateTopKRows={calculateTopKRows}
258
+ table={table}
259
+ />
260
+ );
267
261
 
268
- return (
269
- <div
270
- className={cn(
271
- "flex flex-col h-full pt-0.5 pb-3 justify-between items-start",
272
- headerJustify === "center" && "items-center",
273
- headerJustify === "right" && "items-end",
274
- )}
275
- >
276
- {dataTableColumnHeader}
277
- <TableColumnSummary columnId={key} />
278
- </div>
279
- );
280
- },
262
+ // Row headers have no summaries
263
+ if (rowHeadersSet.has(key)) {
264
+ return dataTableColumnHeader;
265
+ }
281
266
 
282
- cell: ({ column, renderValue, getValue, cell }) => {
283
- function selectCell() {
284
- if (selection !== "single-cell" && selection !== "multi-cell") {
285
- return;
286
- }
267
+ return (
268
+ <div
269
+ className={cn(
270
+ "flex flex-col h-full pt-0.5 pb-3 justify-between items-start",
271
+ headerJustify === "center" && "items-center",
272
+ headerJustify === "right" && "items-end",
273
+ )}
274
+ >
275
+ {dataTableColumnHeader}
276
+ <TableColumnSummary columnId={key} />
277
+ </div>
278
+ );
279
+ },
287
280
 
288
- cell.toggleSelected?.();
281
+ cell: ({ column, renderValue, getValue, cell }) => {
282
+ function selectCell() {
283
+ if (selection !== "single-cell" && selection !== "multi-cell") {
284
+ return;
289
285
  }
290
286
 
291
- const justify = getJustify(key);
292
- const wrapped = wrappedColumns?.includes(key);
293
- const isCellSelected = cell?.getIsSelected?.() || false;
294
- const canSelectCell =
295
- (selection === "single-cell" || selection === "multi-cell") &&
296
- !isCellSelected;
297
-
298
- const dataType = column.columnDef.meta?.dataType;
299
- const isNumeric = isNumericType(dataType);
300
- const cellStyles = getCellStyleClass({
301
- justify,
302
- wrapped,
303
- canSelectCell,
304
- isSelected: isCellSelected,
305
- isNumeric,
306
- });
307
-
308
- const renderedCell = renderCellValue({
309
- column,
310
- renderValue,
311
- getValue,
312
- selectCell,
313
- cellStyles,
314
- });
315
-
316
- // Row headers are bold
317
- if (rowHeadersSet.has(key)) {
318
- return <b>{renderedCell}</b>;
319
- }
287
+ cell.toggleSelected?.();
288
+ }
320
289
 
321
- return renderedCell;
322
- },
323
- // Remove any default filtering
324
- filterFn: undefined,
325
- // Unnamed index columns and geometry columns are not sortable
326
- enableSorting: !!key && getMeta(key).dataType !== "geometry",
327
- meta: {
328
- ...getMeta(key),
329
- width: columnWidths?.[key],
330
- },
331
- // size seeds the width before measurement; minSize/maxSize pin
332
- // getSize() to the fixed width so the per-paint measurement writeback
333
- // cannot drift the header width or sticky-pin offsets.
334
- ...(columnWidths?.[key] !== undefined
335
- ? {
336
- size: columnWidths[key],
337
- minSize: columnWidths[key],
338
- maxSize: columnWidths[key],
339
- }
340
- : {}),
341
- }),
342
- );
290
+ const justify = getJustify(key);
291
+ const wrapped = wrappedColumns?.includes(key);
292
+ const isCellSelected = cell?.getIsSelected?.() || false;
293
+ const canSelectCell =
294
+ (selection === "single-cell" || selection === "multi-cell") &&
295
+ !isCellSelected;
296
+
297
+ const dataType = column.columnDef.meta?.dataType;
298
+ const isNumeric = isNumericType(dataType);
299
+ const cellStyles = getCellStyleClass({
300
+ justify,
301
+ wrapped,
302
+ canSelectCell,
303
+ isSelected: isCellSelected,
304
+ isNumeric,
305
+ });
306
+
307
+ const renderedCell = renderCellValue({
308
+ column,
309
+ renderValue,
310
+ getValue,
311
+ selectCell,
312
+ cellStyles,
313
+ });
314
+
315
+ // Row headers are bold
316
+ if (rowHeadersSet.has(key)) {
317
+ return <b>{renderedCell}</b>;
318
+ }
319
+
320
+ return renderedCell;
321
+ },
322
+ // Remove any default filtering
323
+ filterFn: undefined,
324
+ // Unnamed index columns and geometry columns are not sortable
325
+ enableSorting: !!key && getMeta(key).dataType !== "geometry",
326
+ meta: {
327
+ ...getMeta(key),
328
+ width: columnWidths?.[key],
329
+ },
330
+ // size seeds the width before measurement; minSize/maxSize pin
331
+ // getSize() to the fixed width so the per-paint measurement writeback
332
+ // cannot drift the header width or sticky-pin offsets.
333
+ ...(columnWidths?.[key] !== undefined
334
+ ? {
335
+ size: columnWidths[key],
336
+ minSize: columnWidths[key],
337
+ maxSize: columnWidths[key],
338
+ }
339
+ : {}),
340
+ }));
343
341
 
344
342
  if (selection === "single" || selection === "multi") {
345
343
  columns.unshift({
@@ -41,7 +41,7 @@ function toggleAllLines({
41
41
  }
42
42
  }
43
43
 
44
- for (let pos = selection.from; pos <= selection.to; ) {
44
+ for (let pos = selection.from; pos <= selection.to;) {
45
45
  const line = view.state.doc.lineAt(pos);
46
46
  const lineText = line.text;
47
47
 
@@ -94,23 +94,21 @@ const getLucideIconList = once(async (): Promise<Completion[]> => {
94
94
  return `https://cdn.jsdelivr.net/npm/lucide-static@0.452.0/icons/${iconName}.svg`;
95
95
  };
96
96
 
97
- return Object.entries(iconList).map(
98
- ([iconName, aliases]): Completion => ({
99
- label: `::${iconName}`,
100
- displayLabel: iconName,
101
- type: "lucide-icon",
102
- boost: 10,
103
- apply: `::lucide:${iconName}::`,
104
- detail: aliases.join(", "),
105
- info: () => {
106
- const img = document.createElement("img");
107
- img.src = asSvg(iconName);
108
- img.style.width = "24px";
109
- img.style.height = "24px";
110
- return img;
111
- },
112
- }),
113
- );
97
+ return Object.entries(iconList).map(([iconName, aliases]): Completion => ({
98
+ label: `::${iconName}`,
99
+ displayLabel: iconName,
100
+ type: "lucide-icon",
101
+ boost: 10,
102
+ apply: `::lucide:${iconName}::`,
103
+ detail: aliases.join(", "),
104
+ info: () => {
105
+ const img = document.createElement("img");
106
+ img.src = asSvg(iconName);
107
+ img.style.width = "24px";
108
+ img.style.height = "24px";
109
+ return img;
110
+ },
111
+ }));
114
112
  });
115
113
 
116
114
  // Completion provider for LaTeX-style UTF-8 symbols