Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
a422532
feat: Set up a custom renderer for data frames.
Artmann Oct 8, 2025
3f9c6af
wip
Artmann Oct 9, 2025
e334698
feat: Implement deepnote big number chart support and renderer
tkislan Oct 13, 2025
87f4a09
Merge remote-tracking branch 'origin/chris/display-data-frames' into …
tkislan Oct 13, 2025
62297c2
refactor: Clean up debug logs and improve big number block conversion…
tkislan Oct 13, 2025
7878345
feat: Pass block metadata to cell outputs for renderer to access
tkislan Oct 13, 2025
a12d042
feat: Set up a custom renderer for data frames.
Artmann Oct 8, 2025
c19acd4
wip
Artmann Oct 9, 2025
066229a
add the table state.
Artmann Oct 9, 2025
e36b9c0
page size handling
Artmann Oct 9, 2025
558035f
add page navigation
Artmann Oct 13, 2025
5113db6
Generate Python code before executing the cell.
Artmann Oct 13, 2025
1ba9ab4
clean up
Artmann Oct 13, 2025
a51a150
pr feedback.
Artmann Oct 13, 2025
98d7fe6
Update build/esbuild/build.ts
Artmann Oct 13, 2025
debe3a3
feat: Support Deepnote input blocks
tkislan Oct 13, 2025
a476bfd
feat: Move DEEPNOTE_VSCODE_RAW_CONTENT_KEY into constants file
tkislan Oct 13, 2025
b6752ca
Merge branch 'tomaskislan/grn-4762-support-big-number-blocks' into to…
tkislan Oct 13, 2025
3a4d579
feedback
Artmann Oct 13, 2025
01569a0
feat: Add Deepnote input blocks converters
tkislan Oct 13, 2025
402f077
refactor: Remove debug logs and refine metadata parsing in Deepnote c…
tkislan Oct 13, 2025
40ede24
feat: Add chart big number converter tests
tkislan Oct 13, 2025
d220422
Reformat test code
tkislan Oct 14, 2025
78d3cb7
Refactor ChartBigNumberBlockConverter tests to use deepStrictEqual fo…
tkislan Oct 14, 2025
79b34ba
Remove debug console.log
tkislan Oct 14, 2025
e48a37f
Merge branch 'tomaskislan/grn-4762-support-big-number-blocks' into to…
tkislan Oct 14, 2025
4fa78e2
docs and metadata changes.
Artmann Oct 14, 2025
c1becf8
fix: Spread operator object fallback
tkislan Oct 14, 2025
e8ce411
Merge remote-tracking branch 'origin/chris/display-data-frames' into …
tkislan Oct 14, 2025
8ae05ab
use the latest blocks package.
Artmann Oct 14, 2025
3597ce3
Merge branch 'main' into chris/display-data-frames
Artmann Oct 14, 2025
9fec8d4
add the packages permission
Artmann Oct 14, 2025
0537364
simplify execution flow.
Artmann Oct 14, 2025
9b9216a
remove copyright header
Artmann Oct 14, 2025
e5a1bba
clean up the code
Artmann Oct 14, 2025
e7cccb9
Merge branch 'main' into chris/display-data-frames
Artmann Oct 14, 2025
895fe09
revert controller changes
Artmann Oct 14, 2025
54ca963
pr feedback
Artmann Oct 14, 2025
8309267
Merge branch 'main' into chris/display-data-frames
Artmann Oct 14, 2025
df330bc
pr feedback
Artmann Oct 15, 2025
8b88881
fix the tests
Artmann Oct 15, 2025
8386006
guard metadata spread against undefined.
Artmann Oct 15, 2025
8121bfa
Merge remote-tracking branch 'origin/chris/display-data-frames' into …
tkislan Oct 15, 2025
3bdf030
Merge remote-tracking branch 'origin/main' into tomaskislan/grn-4762-…
tkislan Oct 16, 2025
d9afa1a
fix: Merge cleanup
tkislan Oct 16, 2025
e2b6c36
More merge cleanup
tkislan Oct 16, 2025
722ab50
Fix test
tkislan Oct 16, 2025
628ab6e
feat: Add big number chart json config execution support
tkislan Oct 16, 2025
ed5329d
fix: Enhance error handling for big number metadata parsing and impro…
tkislan Oct 16, 2025
6649ca8
refactor: Simplify chart big number renderer by directly rendering to…
tkislan Oct 16, 2025
a3007ac
Merge remote-tracking branch 'origin/main' into tomaskislan/grn-4762-…
tkislan Oct 16, 2025
b25656b
Fix import
tkislan Oct 16, 2025
8014bc3
fix: Change deepnote_big_number_comparison_type to string type for be…
tkislan Oct 16, 2025
85c8b70
fix: Remove constants, accidentaly added to wrong branch
tkislan Oct 16, 2025
68567e0
Merge branch 'main' into tomaskislan/grn-4762-support-big-number-blocks
tkislan Oct 17, 2025
4908fed
Merge remote-tracking branch 'origin/tomaskislan/grn-4762-support-big…
tkislan Oct 17, 2025
067f757
Merge remote-tracking branch 'origin/main' into tomaskislan/grn-4762-…
tkislan Oct 17, 2025
cc3f23c
Fix imports
tkislan Oct 17, 2025
88c55a0
Merge remote-tracking branch 'origin/tomaskislan/grn-4762-support-big…
tkislan Oct 17, 2025
8ba67da
fix: Fix imports
tkislan Oct 17, 2025
6ee3612
fix: Remove unused code
tkislan Oct 17, 2025
f2c01ee
Merge remote-tracking branch 'origin/tomaskislan/grn-4762-support-big…
tkislan Oct 17, 2025
95fd687
feat(big-number): Integrate react-error-boundary for error handling a…
tkislan Oct 17, 2025
05ab7a0
Update test snapshots
tkislan Oct 17, 2025
4c1c4e2
Merge remote-tracking branch 'origin/tomaskislan/grn-4762-support-big…
tkislan Oct 17, 2025
6337c84
feat: Update input create default values to match those in deepnote app
tkislan Oct 20, 2025
5f05be1
Merge branch 'main' into tomaskislan/grn-4762-support-big-number-blocks
jamesbhobbs Oct 20, 2025
5d14ba3
Merge branch 'tomaskislan/grn-4762-support-big-number-blocks' into to…
jamesbhobbs Oct 20, 2025
a1711c4
feat: Display input block type in notebook cell status bar
tkislan Oct 21, 2025
8d83d0c
fix: Fix spell check in test
tkislan Oct 21, 2025
60442ec
Merge remote-tracking branch 'origin/main' into tomaskislan/grn-4762-…
tkislan Oct 21, 2025
236cccd
Merge branch 'main' into tomaskislan/grn-4762-support-big-number-blocks
tkislan Oct 22, 2025
ed680fc
Merge remote-tracking branch 'origin/tomaskislan/grn-4762-support-big…
tkislan Oct 22, 2025
6691448
Merge branch 'tomaskislan/grn-4776-support-input-blocks' of github.co…
tkislan Oct 22, 2025
81ae526
Merge remote-tracking branch 'origin/main' into tomaskislan/grn-4776-…
tkislan Oct 23, 2025
4c5e886
Merge branch 'main' into tomaskislan/grn-4776-support-input-blocks
tkislan Oct 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 201 additions & 0 deletions src/notebooks/deepnote/converters/inputConverters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
import { NotebookCellData, NotebookCellKind } from 'vscode';
import { z } from 'zod';

import type { BlockConverter } from './blockConverter';
import type { DeepnoteBlock } from '../../../platform/deepnote/deepnoteTypes';
import {
DeepnoteTextInputMetadataSchema,
DeepnoteTextareaInputMetadataSchema,
DeepnoteSelectInputMetadataSchema,
DeepnoteSliderInputMetadataSchema,
DeepnoteCheckboxInputMetadataSchema,
DeepnoteDateInputMetadataSchema,
DeepnoteDateRangeInputMetadataSchema,
DeepnoteFileInputMetadataSchema,
DeepnoteButtonMetadataSchema
} from '../deepnoteSchemas';
import { parseJsonWithFallback } from '../dataConversionUtils';
import { DEEPNOTE_VSCODE_RAW_CONTENT_KEY } from './constants';

export abstract class BaseInputBlockConverter<T extends z.ZodObject> implements BlockConverter {
abstract schema(): T;
abstract getSupportedType(): string;
abstract defaultConfig(): z.infer<T>;

applyChangesToBlock(block: DeepnoteBlock, cell: NotebookCellData): void {
block.content = '';

const config = this.schema().safeParse(parseJsonWithFallback(cell.value));

if (config.success !== true) {
block.metadata = {
...(block.metadata ?? {}),
[DEEPNOTE_VSCODE_RAW_CONTENT_KEY]: cell.value
};
return;
}

if (block.metadata != null) {
delete block.metadata[DEEPNOTE_VSCODE_RAW_CONTENT_KEY];
}

block.metadata = {
...(block.metadata ?? {}),
...config.data
};
}

canConvert(blockType: string): boolean {
return blockType.toLowerCase() === this.getSupportedType();
}

convertToCell(block: DeepnoteBlock): NotebookCellData {
const deepnoteJupyterRawContentResult = z.string().safeParse(block.metadata?.[DEEPNOTE_VSCODE_RAW_CONTENT_KEY]);
const deepnoteMetadataResult = this.schema().safeParse(block.metadata);

if (deepnoteMetadataResult.error != null) {
console.error('Error parsing deepnote input metadata:', deepnoteMetadataResult.error);
console.debug('Metadata:', JSON.stringify(block.metadata));
}

const configStr = deepnoteJupyterRawContentResult.success
? deepnoteJupyterRawContentResult.data
: deepnoteMetadataResult.success
? JSON.stringify(deepnoteMetadataResult.data, null, 2)
: JSON.stringify(this.defaultConfig(), null, 2);

const cell = new NotebookCellData(NotebookCellKind.Code, configStr, 'json');

return cell;
}

getSupportedTypes(): string[] {
return [this.getSupportedType()];
}
}

export class InputTextBlockConverter extends BaseInputBlockConverter<typeof DeepnoteTextInputMetadataSchema> {
private readonly DEFAULT_INPUT_TEXT_CONFIG = DeepnoteTextInputMetadataSchema.parse({});

schema() {
return DeepnoteTextInputMetadataSchema;
}
getSupportedType() {
return 'input-text';
}
defaultConfig() {
return this.DEFAULT_INPUT_TEXT_CONFIG;
}
}

export class InputTextareaBlockConverter extends BaseInputBlockConverter<typeof DeepnoteTextareaInputMetadataSchema> {
private readonly DEFAULT_INPUT_TEXTAREA_CONFIG = DeepnoteTextareaInputMetadataSchema.parse({});

schema() {
return DeepnoteTextareaInputMetadataSchema;
}
getSupportedType() {
return 'input-textarea';
}
defaultConfig() {
return this.DEFAULT_INPUT_TEXTAREA_CONFIG;
}
}

export class InputSelectBlockConverter extends BaseInputBlockConverter<typeof DeepnoteSelectInputMetadataSchema> {
private readonly DEFAULT_INPUT_SELECT_CONFIG = DeepnoteSelectInputMetadataSchema.parse({});

schema() {
return DeepnoteSelectInputMetadataSchema;
}
getSupportedType() {
return 'input-select';
}
defaultConfig() {
return this.DEFAULT_INPUT_SELECT_CONFIG;
}
}

export class InputSliderBlockConverter extends BaseInputBlockConverter<typeof DeepnoteSliderInputMetadataSchema> {
private readonly DEFAULT_INPUT_SLIDER_CONFIG = DeepnoteSliderInputMetadataSchema.parse({});

schema() {
return DeepnoteSliderInputMetadataSchema;
}
getSupportedType() {
return 'input-slider';
}
defaultConfig() {
return this.DEFAULT_INPUT_SLIDER_CONFIG;
}
}

export class InputCheckboxBlockConverter extends BaseInputBlockConverter<typeof DeepnoteCheckboxInputMetadataSchema> {
private readonly DEFAULT_INPUT_CHECKBOX_CONFIG = DeepnoteCheckboxInputMetadataSchema.parse({});

schema() {
return DeepnoteCheckboxInputMetadataSchema;
}
getSupportedType() {
return 'input-checkbox';
}
defaultConfig() {
return this.DEFAULT_INPUT_CHECKBOX_CONFIG;
}
}

export class InputDateBlockConverter extends BaseInputBlockConverter<typeof DeepnoteDateInputMetadataSchema> {
private readonly DEFAULT_INPUT_DATE_CONFIG = DeepnoteDateInputMetadataSchema.parse({});

schema() {
return DeepnoteDateInputMetadataSchema;
}
getSupportedType() {
return 'input-date';
}
defaultConfig() {
return this.DEFAULT_INPUT_DATE_CONFIG;
}
}

export class InputDateRangeBlockConverter extends BaseInputBlockConverter<typeof DeepnoteDateRangeInputMetadataSchema> {
private readonly DEFAULT_INPUT_DATE_RANGE_CONFIG = DeepnoteDateRangeInputMetadataSchema.parse({});

schema() {
return DeepnoteDateRangeInputMetadataSchema;
}
getSupportedType() {
return 'input-date-range';
}
defaultConfig() {
return this.DEFAULT_INPUT_DATE_RANGE_CONFIG;
}
}

export class InputFileBlockConverter extends BaseInputBlockConverter<typeof DeepnoteFileInputMetadataSchema> {
private readonly DEFAULT_INPUT_FILE_CONFIG = DeepnoteFileInputMetadataSchema.parse({});

schema() {
return DeepnoteFileInputMetadataSchema;
}
getSupportedType() {
return 'input-file';
}
defaultConfig() {
return this.DEFAULT_INPUT_FILE_CONFIG;
}
}

export class ButtonBlockConverter extends BaseInputBlockConverter<typeof DeepnoteButtonMetadataSchema> {
private readonly DEFAULT_BUTTON_CONFIG = DeepnoteButtonMetadataSchema.parse({});

schema() {
return DeepnoteButtonMetadataSchema;
}
getSupportedType() {
return 'button';
}
defaultConfig() {
return this.DEFAULT_BUTTON_CONFIG;
}
}
Loading