@marimo-team/islands 0.25.1-dev26 → 0.25.1-dev28

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.
Files changed (170) hide show
  1. package/dist/{ErrorBoundary-pWWhtr0s.js → ErrorBoundary-CE6-1WC1.js} +1 -1
  2. package/dist/{code-visibility-Ba_KMLhg.js → code-visibility--u2Q2Zfx.js} +1 -1
  3. package/dist/{common-Cqwp2VSj.js → common-hHL7iKzA.js} +1 -1
  4. package/dist/{data-grid-overlay-editor-CpH8-A59.js → data-grid-overlay-editor-v7VZO5up.js} +1 -1
  5. package/dist/{feedback-button-CJxD9fy8.js → feedback-button-C3Ya1IXo.js} +2 -2
  6. package/dist/{glide-data-editor-cm-NQofk.js → glide-data-editor-BKOLh2Tv.js} +3 -3
  7. package/dist/{globals-BquX8N9R.js → globals-DOJr_y24.js} +1 -1
  8. package/dist/main.js +6 -6
  9. package/dist/{number-overlay-editor-3AkAzj7F.js → number-overlay-editor-DkEFJYK7.js} +1 -1
  10. package/dist/{reveal-component-rC5k5pu3.js → reveal-component-rbEv9ppg.js} +2 -2
  11. package/dist/style.css +1 -1
  12. package/package.json +1 -1
  13. package/src/__mocks__/common.ts +3 -3
  14. package/src/__tests__/CellStatus.test.tsx +1 -1
  15. package/src/__tests__/setup.ts +7 -7
  16. package/src/components/app-config/ai-config.tsx +2 -0
  17. package/src/components/chat/chat-panel.tsx +19 -8
  18. package/src/components/data-table/column-summary/chart-spec-model.tsx +4 -4
  19. package/src/components/dependency-graph/elements.ts +2 -2
  20. package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +107 -0
  21. package/src/components/editor/actions/pair-with-agent.tsx +119 -0
  22. package/src/components/editor/actions/useNotebookActions.tsx +2 -1
  23. package/src/components/editor/ai/add-cell-with-ai.tsx +2 -0
  24. package/src/components/editor/ai/staged-cell-submission.ts +2 -2
  25. package/src/components/editor/ai/transport/chat-transport.tsx +1 -1
  26. package/src/components/editor/connections/database/as-code.ts +44 -44
  27. package/src/components/editor/connections/storage/as-code.ts +3 -3
  28. package/src/components/editor/file-tree/requesting-tree.tsx +16 -13
  29. package/src/components/editor/navigation/clipboard.ts +2 -2
  30. package/src/components/editor/output/ansi-reduce.ts +13 -13
  31. package/src/components/slides/__tests__/minimap-actions.test.tsx +7 -7
  32. package/src/components/slides/__tests__/minimap.test.ts +12 -12
  33. package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +8 -8
  34. package/src/core/ai/context/__tests__/registry.test.ts +31 -28
  35. package/src/core/ai/context/providers/cell-output.ts +8 -8
  36. package/src/core/ai/context/providers/datasource.ts +10 -7
  37. package/src/core/ai/context/providers/error.ts +7 -7
  38. package/src/core/ai/context/providers/file.ts +8 -8
  39. package/src/core/ai/context/providers/tables.ts +7 -7
  40. package/src/core/ai/context/providers/variable.ts +7 -7
  41. package/src/core/ai/context/registry.ts +18 -18
  42. package/src/core/ai/ids/ids.ts +5 -5
  43. package/src/core/ai/model-registry.ts +12 -9
  44. package/src/core/ai/staged-cells.ts +6 -6
  45. package/src/core/ai/tools/base.ts +6 -6
  46. package/src/core/ai/tools/edit-notebook-tool.ts +6 -6
  47. package/src/core/ai/tools/registry.ts +4 -4
  48. package/src/core/ai/tools/run-cells-tool.ts +7 -7
  49. package/src/core/ai/tools/sample-tool.ts +6 -6
  50. package/src/core/codemirror/cells/debugger-decorations.ts +13 -7
  51. package/src/core/codemirror/cells/line-timing-decorations.ts +9 -9
  52. package/src/core/codemirror/cells/traceback-decorations.ts +7 -4
  53. package/src/core/codemirror/code-lens/extension.ts +13 -13
  54. package/src/core/codemirror/copilot/__tests__/language-server.test.ts +6 -6
  55. package/src/core/codemirror/copilot/__tests__/transport.test.ts +12 -12
  56. package/src/core/codemirror/copilot/language-server.ts +13 -13
  57. package/src/core/codemirror/copilot/transport.ts +1 -1
  58. package/src/core/codemirror/find-replace/search-highlight.ts +5 -5
  59. package/src/core/codemirror/go-to-definition/underline.ts +3 -3
  60. package/src/core/codemirror/keymaps/vim.ts +3 -3
  61. package/src/core/codemirror/language/languages/markdown.ts +8 -8
  62. package/src/core/codemirror/language/languages/python.ts +7 -7
  63. package/src/core/codemirror/language/languages/sql/completion-builder.ts +5 -5
  64. package/src/core/codemirror/language/languages/sql/completion-store.ts +4 -4
  65. package/src/core/codemirror/language/languages/sql/sql.ts +21 -21
  66. package/src/core/codemirror/lsp/__tests__/transports.test.ts +10 -10
  67. package/src/core/codemirror/lsp/federated-lsp.ts +29 -27
  68. package/src/core/codemirror/lsp/notebook-lsp.ts +21 -21
  69. package/src/core/codemirror/misc/__tests__/dnd.test.ts +10 -10
  70. package/src/core/codemirror/misc/__tests__/paste.test.ts +7 -4
  71. package/src/core/codemirror/reactive-references/extension.ts +3 -3
  72. package/src/core/codemirror/rtc/loro/awareness.ts +12 -12
  73. package/src/core/codemirror/rtc/loro/sync.ts +5 -5
  74. package/src/core/codemirror/vim/cursor-visibility.ts +3 -3
  75. package/src/core/dom/ui-element.ts +5 -5
  76. package/src/core/dom/uiregistry.ts +10 -10
  77. package/src/core/hotkeys/hotkeys.ts +9 -9
  78. package/src/core/islands/__tests__/bridge.test.ts +4 -4
  79. package/src/core/islands/__tests__/test-utils.tsx +4 -4
  80. package/src/core/islands/bridge.ts +85 -82
  81. package/src/core/islands/components/web-components.tsx +7 -7
  82. package/src/core/islands/worker/__tests__/controller.test.ts +1 -1
  83. package/src/core/islands/worker/controller.ts +6 -3
  84. package/src/core/islands/worker-factory.ts +2 -2
  85. package/src/core/kernel/RuntimeState.ts +4 -4
  86. package/src/core/lsp/__tests__/transport.test.ts +19 -19
  87. package/src/core/lsp/transport.ts +5 -5
  88. package/src/core/network/CachingRequestRegistry.ts +2 -2
  89. package/src/core/network/DeferredRequestRegistry.ts +4 -4
  90. package/src/core/runtime/runtime.ts +25 -20
  91. package/src/core/static/virtual-file-tracker.ts +5 -5
  92. package/src/core/wasm/__tests__/bridge.test.ts +2 -2
  93. package/src/core/wasm/bridge.ts +130 -126
  94. package/src/core/wasm/router.ts +5 -5
  95. package/src/core/wasm/store.ts +4 -4
  96. package/src/core/wasm/worker/bootstrap.ts +8 -5
  97. package/src/core/wasm/worker/message-buffer.ts +3 -3
  98. package/src/core/websocket/transports/__tests__/ws.test.ts +8 -8
  99. package/src/core/websocket/transports/basic.ts +15 -8
  100. package/src/core/websocket/transports/sse.ts +7 -7
  101. package/src/core/websocket/transports/transport.ts +3 -3
  102. package/src/core/websocket/transports/ws.ts +9 -7
  103. package/src/hooks/__tests__/useOverflowDetection.test.tsx +5 -5
  104. package/src/hooks/__tests__/useResizeObserver.test.tsx +12 -12
  105. package/src/plugins/core/registerReactComponent.tsx +5 -5
  106. package/src/plugins/core/sidebar-element.tsx +2 -2
  107. package/src/plugins/impl/ButtonPlugin.tsx +3 -3
  108. package/src/plugins/impl/CheckboxPlugin.tsx +3 -3
  109. package/src/plugins/impl/CodeEditorPlugin.tsx +3 -3
  110. package/src/plugins/impl/DatePickerPlugin.tsx +3 -3
  111. package/src/plugins/impl/DateRangePlugin.tsx +3 -3
  112. package/src/plugins/impl/DateTimePickerPlugin.tsx +3 -3
  113. package/src/plugins/impl/DictPlugin.tsx +3 -3
  114. package/src/plugins/impl/DropdownPlugin.tsx +3 -3
  115. package/src/plugins/impl/FileUploadPlugin.tsx +3 -3
  116. package/src/plugins/impl/MatrixPlugin.tsx +4 -4
  117. package/src/plugins/impl/MicrophonePlugin.tsx +3 -3
  118. package/src/plugins/impl/MultiselectPlugin.tsx +3 -3
  119. package/src/plugins/impl/NumberPlugin.tsx +3 -3
  120. package/src/plugins/impl/RadioPlugin.tsx +3 -3
  121. package/src/plugins/impl/RangeSliderPlugin.tsx +3 -3
  122. package/src/plugins/impl/RefreshPlugin.tsx +3 -3
  123. package/src/plugins/impl/SliderPlugin.tsx +3 -3
  124. package/src/plugins/impl/SwitchPlugin.tsx +3 -3
  125. package/src/plugins/impl/TabsPlugin.tsx +3 -3
  126. package/src/plugins/impl/TextAreaPlugin.tsx +3 -3
  127. package/src/plugins/impl/TextInputPlugin.tsx +3 -3
  128. package/src/plugins/impl/__tests__/MatrixPlugin.test.tsx +2 -2
  129. package/src/plugins/impl/anywidget/model.ts +10 -10
  130. package/src/plugins/impl/anywidget/registry.ts +12 -9
  131. package/src/plugins/impl/anywidget/runtime.ts +11 -9
  132. package/src/plugins/impl/anywidget/widget-binding.ts +6 -6
  133. package/src/plugins/impl/matplotlib/MatplotlibPlugin.tsx +3 -3
  134. package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +2 -2
  135. package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +2 -2
  136. package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +10 -10
  137. package/src/plugins/impl/panel/utils.ts +5 -5
  138. package/src/plugins/impl/plotly/PlotlyPlugin.tsx +3 -3
  139. package/src/plugins/impl/vega/VegaPlugin.tsx +3 -3
  140. package/src/plugins/impl/vega/__tests__/use-vega-container-remeasure.test.ts +7 -7
  141. package/src/plugins/layout/AccordionPlugin.tsx +3 -3
  142. package/src/plugins/layout/CalloutPlugin.tsx +3 -3
  143. package/src/plugins/layout/ImageComparisonPlugin.tsx +5 -3
  144. package/src/plugins/layout/JsonOutputPlugin.tsx +3 -3
  145. package/src/plugins/layout/MimeRenderPlugin.tsx +3 -3
  146. package/src/plugins/layout/NavigationMenuPlugin.tsx +3 -3
  147. package/src/plugins/layout/OutlinePlugin.tsx +3 -3
  148. package/src/plugins/layout/ProgressPlugin.tsx +3 -3
  149. package/src/plugins/layout/RoutesPlugin.tsx +3 -3
  150. package/src/plugins/layout/StatPlugin.tsx +3 -3
  151. package/src/plugins/layout/TexPlugin.tsx +3 -3
  152. package/src/plugins/layout/carousel/CarouselPlugin.tsx +4 -4
  153. package/src/plugins/layout/mermaid/MermaidPlugin.tsx +3 -3
  154. package/src/utils/Deferred.ts +6 -6
  155. package/src/utils/async-capture-tracker.ts +10 -7
  156. package/src/utils/errors.ts +5 -5
  157. package/src/utils/id-tree.tsx +83 -80
  158. package/src/utils/lru.ts +1 -1
  159. package/src/utils/multi-map.ts +14 -12
  160. package/src/utils/paths.ts +6 -6
  161. package/src/utils/pluralize.ts +3 -3
  162. package/src/utils/progress.ts +6 -6
  163. package/src/utils/python-poet/poet.ts +14 -14
  164. package/src/utils/routes.ts +4 -2
  165. package/src/utils/semaphore.ts +6 -6
  166. package/src/utils/storage/storage.ts +6 -6
  167. package/src/utils/storage/typed.ts +16 -12
  168. package/src/utils/time.ts +9 -9
  169. package/src/utils/timed-cache.ts +4 -4
  170. package/src/utils/tracer.ts +9 -6
@@ -25,9 +25,9 @@ interface Data {
25
25
  type S = string | null;
26
26
 
27
27
  export class RadioPlugin implements IPlugin<S, Data> {
28
- tagName = "marimo-radio";
28
+ public tagName = "marimo-radio";
29
29
 
30
- validator = z.object({
30
+ public validator = z.object({
31
31
  initialValue: z.string().nullable(),
32
32
  inline: z.boolean().default(false),
33
33
  label: z.string().nullable(),
@@ -35,7 +35,7 @@ export class RadioPlugin implements IPlugin<S, Data> {
35
35
  disabled: z.boolean().optional(),
36
36
  });
37
37
 
38
- render(props: IPluginProps<S, Data>): JSX.Element {
38
+ public render(props: IPluginProps<S, Data>): JSX.Element {
39
39
  return (
40
40
  <Radio {...props.data} value={props.value} setValue={props.setValue} />
41
41
  );
@@ -26,9 +26,9 @@ interface Data {
26
26
  }
27
27
 
28
28
  export class RangeSliderPlugin implements IPlugin<T, Data> {
29
- tagName = "marimo-range-slider";
29
+ public tagName = "marimo-range-slider";
30
30
 
31
- validator = z.object({
31
+ public validator = z.object({
32
32
  initialValue: z.array(z.number()),
33
33
  label: z.string().nullable(),
34
34
  start: z.number(),
@@ -42,7 +42,7 @@ export class RangeSliderPlugin implements IPlugin<T, Data> {
42
42
  disabled: z.boolean().optional(),
43
43
  });
44
44
 
45
- render(props: IPluginProps<T, Data>): JSX.Element {
45
+ public render(props: IPluginProps<T, Data>): JSX.Element {
46
46
  const valueMap = (sliderValue: number): number => {
47
47
  if (props.data.steps && props.data.steps.length > 0) {
48
48
  return props.data.steps[sliderValue];
@@ -51,9 +51,9 @@ const zodTimestring = z.string().superRefine((s, ctx) => {
51
51
  });
52
52
 
53
53
  export class RefreshPlugin implements IPlugin<Value, Data> {
54
- tagName = "marimo-refresh";
54
+ public tagName = "marimo-refresh";
55
55
 
56
- validator = z.object({
56
+ public validator = z.object({
57
57
  options: z
58
58
  .array(z.union([zodTimestring, z.number().min(MIN_INTERVAL)]))
59
59
  .default([]),
@@ -63,7 +63,7 @@ export class RefreshPlugin implements IPlugin<Value, Data> {
63
63
  label: z.string().nullable(),
64
64
  });
65
65
 
66
- render(props: IPluginProps<Value, Data>): JSX.Element {
66
+ public render(props: IPluginProps<Value, Data>): JSX.Element {
67
67
  return <RefreshComponent {...props} />;
68
68
  }
69
69
  }
@@ -31,9 +31,9 @@ interface Data {
31
31
  }
32
32
 
33
33
  export class SliderPlugin implements IPlugin<T, Data> {
34
- tagName = "marimo-slider";
34
+ public tagName = "marimo-slider";
35
35
 
36
- validator = z.object({
36
+ public validator = z.object({
37
37
  initialValue: z.number(),
38
38
  label: z.string().nullable(),
39
39
  start: z.number(),
@@ -48,7 +48,7 @@ export class SliderPlugin implements IPlugin<T, Data> {
48
48
  disabled: z.boolean().optional(),
49
49
  });
50
50
 
51
- render(props: IPluginProps<T, Data>): JSX.Element {
51
+ public render(props: IPluginProps<T, Data>): JSX.Element {
52
52
  // Create the valueMap function
53
53
  const valueMap = (sliderValue: number): number => {
54
54
  const { steps } = props.data;
@@ -13,15 +13,15 @@ interface Data {
13
13
  }
14
14
 
15
15
  export class SwitchPlugin implements IPlugin<T, Data> {
16
- tagName = "marimo-switch";
16
+ public tagName = "marimo-switch";
17
17
 
18
- validator = z.object({
18
+ public validator = z.object({
19
19
  initialValue: z.boolean(),
20
20
  label: z.string().nullable(),
21
21
  disabled: z.boolean().optional(),
22
22
  });
23
23
 
24
- render(props: IPluginProps<T, Data>): JSX.Element {
24
+ public render(props: IPluginProps<T, Data>): JSX.Element {
25
25
  return <SwitchComponent {...props} />;
26
26
  }
27
27
  }
@@ -25,15 +25,15 @@ interface Data {
25
25
  type T = string;
26
26
 
27
27
  export class TabsPlugin implements IPlugin<T, Data> {
28
- tagName = "marimo-tabs";
28
+ public tagName = "marimo-tabs";
29
29
 
30
- validator = z.object({
30
+ public validator = z.object({
31
31
  tabs: z.array(z.string()),
32
32
  label: z.string().nullable(),
33
33
  orientation: z.enum(["horizontal", "vertical"]).default("horizontal"),
34
34
  });
35
35
 
36
- render(props: IPluginProps<T, Data>): JSX.Element {
36
+ public render(props: IPluginProps<T, Data>): JSX.Element {
37
37
  return (
38
38
  <TabComponent
39
39
  {...props.data}
@@ -25,9 +25,9 @@ interface Data {
25
25
  }
26
26
 
27
27
  export class TextAreaPlugin implements IPlugin<T, Data> {
28
- tagName = "marimo-text-area";
28
+ public tagName = "marimo-text-area";
29
29
 
30
- validator = z.object({
30
+ public validator = z.object({
31
31
  initialValue: z.string(),
32
32
  placeholder: z.string(),
33
33
  label: z.string().nullable(),
@@ -39,7 +39,7 @@ export class TextAreaPlugin implements IPlugin<T, Data> {
39
39
  fullWidth: z.boolean().default(false),
40
40
  });
41
41
 
42
- render(props: IPluginProps<T, Data>): JSX.Element {
42
+ public render(props: IPluginProps<T, Data>): JSX.Element {
43
43
  return (
44
44
  <TextAreaComponent
45
45
  {...props.data}
@@ -33,9 +33,9 @@ interface Data {
33
33
  const MASK_PLACEHOLDER = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
34
34
 
35
35
  export class TextInputPlugin implements IPlugin<T, Data> {
36
- tagName = "marimo-text";
36
+ public tagName = "marimo-text";
37
37
 
38
- validator = z.object({
38
+ public validator = z.object({
39
39
  initialValue: z.string(),
40
40
  placeholder: z.string(),
41
41
  label: z.string().nullable(),
@@ -48,7 +48,7 @@ export class TextInputPlugin implements IPlugin<T, Data> {
48
48
  passwordHasValue: z.boolean().optional(),
49
49
  });
50
50
 
51
- render(props: IPluginProps<T, Data>): JSX.Element {
51
+ public render(props: IPluginProps<T, Data>): JSX.Element {
52
52
  // Force remount on cell re-run so masked state resets cleanly
53
53
  const remountKey =
54
54
  props.data.kind === "password"
@@ -54,8 +54,8 @@ beforeEach(() => {
54
54
  // like clientX. Polyfill it so fireEvent.pointerDown/Move/Up work.
55
55
  // oxlint-disable-next-line typescript/no-explicit-any
56
56
  (globalThis as any).PointerEvent = class PointerEvent extends MouseEvent {
57
- readonly pointerId: number;
58
- constructor(type: string, init: PointerEventInit = {}) {
57
+ public readonly pointerId: number;
58
+ public constructor(type: string, init: PointerEventInit = {}) {
59
59
  super(type, init);
60
60
  this.pointerId = init.pointerId ?? 0;
61
61
  }
@@ -64,11 +64,11 @@ export class Model<T extends ModelState> implements AnyModel<T> {
64
64
  * (`widget_manager.get_model`). Assigned by the registry module at
65
65
  * import time to avoid an import cycle.
66
66
  */
67
- static _modelManager: {
67
+ public static _modelManager: {
68
68
  getModel(model_id: WidgetModelId): Promise<Model<any>>;
69
69
  };
70
70
 
71
- constructor(data: T, comm: MarimoComm<T>, signal?: AbortSignal) {
71
+ public constructor(data: T, comm: MarimoComm<T>, signal?: AbortSignal) {
72
72
  this.#data = data;
73
73
  this.#comm = comm;
74
74
  this.#dirtyFields = new Set();
@@ -84,7 +84,7 @@ export class Model<T extends ModelState> implements AnyModel<T> {
84
84
  * Internal marimo API - not part of AnyWidget AFM.
85
85
  * Access via getMarimoInternal().
86
86
  */
87
- [marimoSymbol]: MarimoInternalApi<T> = {
87
+ public [marimoSymbol]: MarimoInternalApi<T> = {
88
88
  updateAndEmitDiffs: (value: T) => this.#updateAndEmitDiffs(value),
89
89
  emitCustomMessage: (
90
90
  message: CustomMessage,
@@ -92,7 +92,7 @@ export class Model<T extends ModelState> implements AnyModel<T> {
92
92
  ) => this.#emitCustomMessage(message, buffers),
93
93
  };
94
94
 
95
- off(eventName?: string | null, callback?: EventHandler | null): void {
95
+ public off(eventName?: string | null, callback?: EventHandler | null): void {
96
96
  if (!eventName) {
97
97
  this.#listeners = {};
98
98
  return;
@@ -106,7 +106,7 @@ export class Model<T extends ModelState> implements AnyModel<T> {
106
106
  this.#listeners[eventName]?.delete(callback);
107
107
  }
108
108
 
109
- send(
109
+ public send(
110
110
  content: any,
111
111
  callbacks?: any,
112
112
  buffers?: ArrayBuffer[] | ArrayBufferView[],
@@ -121,7 +121,7 @@ export class Model<T extends ModelState> implements AnyModel<T> {
121
121
  .then(() => callbacks?.());
122
122
  }
123
123
 
124
- widget_manager = {
124
+ public widget_manager = {
125
125
  async get_model<TT extends ModelState>(
126
126
  model_id: WidgetModelId,
127
127
  ): Promise<AnyModel<TT>> {
@@ -135,18 +135,18 @@ export class Model<T extends ModelState> implements AnyModel<T> {
135
135
  },
136
136
  };
137
137
 
138
- get<K extends keyof T>(key: K): T[K] {
138
+ public get<K extends keyof T>(key: K): T[K] {
139
139
  return this.#data[key];
140
140
  }
141
141
 
142
- set<K extends keyof T>(key: K, value: T[K]): void {
142
+ public set<K extends keyof T>(key: K, value: T[K]): void {
143
143
  this.#data = { ...this.#data, [key]: value };
144
144
  this.#dirtyFields.add(key);
145
145
  this.#emit(`change:${key as K & string}`, value);
146
146
  this.#emitAnyChange();
147
147
  }
148
148
 
149
- save_changes(): void {
149
+ public save_changes(): void {
150
150
  if (this.#dirtyFields.size === 0) {
151
151
  return;
152
152
  }
@@ -169,7 +169,7 @@ export class Model<T extends ModelState> implements AnyModel<T> {
169
169
  * `addEventListener({ signal })`) and is what `modelProxy` uses to
170
170
  * scope listeners to view / binding lifetimes.
171
171
  */
172
- on(
172
+ public on(
173
173
  eventName: string,
174
174
  callback: EventHandler,
175
175
  options?: { signal?: AbortSignal },
@@ -41,7 +41,10 @@ export class WidgetRegistry implements WidgetResolver {
41
41
  #timeout: number;
42
42
  #isEditMode: () => boolean;
43
43
 
44
- constructor(timeout = 10_000, isEditMode: () => boolean = defaultIsEditMode) {
44
+ public constructor(
45
+ timeout = 10_000,
46
+ isEditMode: () => boolean = defaultIsEditMode,
47
+ ) {
45
48
  this.#timeout = timeout;
46
49
  this.#isEditMode = isEditMode;
47
50
  }
@@ -71,7 +74,7 @@ export class WidgetRegistry implements WidgetResolver {
71
74
  * hasn't arrived yet. Rejects after the registry timeout so a ref to
72
75
  * a model that never opens fails loudly instead of hanging.
73
76
  */
74
- getModel(key: WidgetModelId): Promise<Model<ModelState>> {
77
+ public getModel(key: WidgetModelId): Promise<Model<ModelState>> {
75
78
  return this.#getOrCreateRuntime(key).getModel();
76
79
  }
77
80
 
@@ -79,7 +82,7 @@ export class WidgetRegistry implements WidgetResolver {
79
82
  * Get a model synchronously if it exists and has been resolved.
80
83
  * Returns undefined if the model doesn't exist or is still pending.
81
84
  */
82
- getModelSync(key: WidgetModelId): Model<ModelState> | undefined {
85
+ public getModelSync(key: WidgetModelId): Model<ModelState> | undefined {
83
86
  return this.#runtimes.get(key)?.getModelSync();
84
87
  }
85
88
 
@@ -87,14 +90,14 @@ export class WidgetRegistry implements WidgetResolver {
87
90
  * Create a model with a managed lifecycle signal.
88
91
  * The signal is aborted when the entry is deleted.
89
92
  */
90
- createModel(
93
+ public createModel(
91
94
  key: WidgetModelId,
92
95
  factory: (signal: AbortSignal) => Model<ModelState>,
93
96
  ): void {
94
97
  this.#getOrCreateRuntime(key).createModel(factory);
95
98
  }
96
99
 
97
- setModel(key: WidgetModelId, model: Model<ModelState>): void {
100
+ public setModel(key: WidgetModelId, model: Model<ModelState>): void {
98
101
  this.#getOrCreateRuntime(key).setModel(model);
99
102
  }
100
103
 
@@ -105,15 +108,15 @@ export class WidgetRegistry implements WidgetResolver {
105
108
  * Specs only come from kernel-authored notifications; model state
106
109
  * must never be treated as code (it is client-writable).
107
110
  */
108
- setSpec(key: WidgetModelId, spec: EsmSpec): void {
111
+ public setSpec(key: WidgetModelId, spec: EsmSpec): void {
109
112
  this.#getOrCreateRuntime(key).setSpec(spec);
110
113
  }
111
114
 
112
- getWidget<T = unknown>(key: WidgetModelId) {
115
+ public getWidget<T = unknown>(key: WidgetModelId) {
113
116
  return this.#getOrCreateRuntime(key).getWidget<T>();
114
117
  }
115
118
 
116
- createView(options: {
119
+ public createView(options: {
117
120
  modelId: WidgetModelId;
118
121
  el: HTMLElement;
119
122
  signal: AbortSignal;
@@ -125,7 +128,7 @@ export class WidgetRegistry implements WidgetResolver {
125
128
  * Tear down everything known about `key`: the model's lifecycle
126
129
  * signal and the current generation.
127
130
  */
128
- delete(key: WidgetModelId): void {
131
+ public delete(key: WidgetModelId): void {
129
132
  const runtime = this.#runtimes.get(key);
130
133
  if (!runtime) {
131
134
  return;
@@ -60,7 +60,7 @@ export class WidgetRuntime {
60
60
  #generationCleanup = Promise.resolve();
61
61
  #css = "";
62
62
 
63
- constructor(key: WidgetModelId, options: WidgetRuntimeOptions) {
63
+ public constructor(key: WidgetModelId, options: WidgetRuntimeOptions) {
64
64
  this.#key = key;
65
65
  this.#timeout = options.timeout;
66
66
  this.#isEditMode = options.isEditMode;
@@ -68,7 +68,7 @@ export class WidgetRuntime {
68
68
  this.#onModelTimeout = options.onModelTimeout;
69
69
  }
70
70
 
71
- getModel(): Promise<Model<ModelState>> {
71
+ public getModel(): Promise<Model<ModelState>> {
72
72
  if (this.#model.status === "pending" && !this.#modelTimeout) {
73
73
  this.#modelTimeout = setTimeout(() => {
74
74
  if (this.#model.status === "pending") {
@@ -83,18 +83,20 @@ export class WidgetRuntime {
83
83
  return this.#model.promise;
84
84
  }
85
85
 
86
- getModelSync(): Model<ModelState> | undefined {
86
+ public getModelSync(): Model<ModelState> | undefined {
87
87
  return this.#model.status === "resolved" ? this.#model.value : undefined;
88
88
  }
89
89
 
90
- createModel(factory: (signal: AbortSignal) => Model<ModelState>): void {
90
+ public createModel(
91
+ factory: (signal: AbortSignal) => Model<ModelState>,
92
+ ): void {
91
93
  if (this.#model.status !== "pending") {
92
94
  return;
93
95
  }
94
96
  this.#resolveModel(factory(this.#controller.signal));
95
97
  }
96
98
 
97
- setModel(model: Model<ModelState>): void {
99
+ public setModel(model: Model<ModelState>): void {
98
100
  if (this.#model.status !== "pending") {
99
101
  return;
100
102
  }
@@ -121,7 +123,7 @@ export class WidgetRuntime {
121
123
  );
122
124
  }
123
125
 
124
- setSpec(spec: EsmSpec): void {
126
+ public setSpec(spec: EsmSpec): void {
125
127
  if (!this.#esmSpec) {
126
128
  this.#esmSpec = spec;
127
129
  return;
@@ -138,7 +140,7 @@ export class WidgetRuntime {
138
140
  }
139
141
  }
140
142
 
141
- async getWidget<T = unknown>(): Promise<ResolvedWidget<T>> {
143
+ public async getWidget<T = unknown>(): Promise<ResolvedWidget<T>> {
142
144
  const binding = await this.#getCurrentBinding();
143
145
  return {
144
146
  exports: binding.exports as T,
@@ -151,7 +153,7 @@ export class WidgetRuntime {
151
153
  };
152
154
  }
153
155
 
154
- async createView(options: {
156
+ public async createView(options: {
155
157
  el: HTMLElement;
156
158
  signal: AbortSignal;
157
159
  }): Promise<void> {
@@ -341,7 +343,7 @@ export class WidgetRuntime {
341
343
  view.signal.addEventListener("abort", release, { once: true });
342
344
  }
343
345
 
344
- dispose(): void {
346
+ public dispose(): void {
345
347
  if (this.#controller.signal.aborted) {
346
348
  return;
347
349
  }
@@ -59,7 +59,7 @@ class WidgetDefRegistry {
59
59
  * `kernelAuthored: true` only for URLs from an `EsmSpec`; it widens
60
60
  * the import gate to remote and data URLs.
61
61
  */
62
- getModule(options: {
62
+ public getModule(options: {
63
63
  jsUrl: string;
64
64
  jsHash: string;
65
65
  kernelAuthored?: boolean;
@@ -80,7 +80,7 @@ class WidgetDefRegistry {
80
80
  return promise;
81
81
  }
82
82
 
83
- invalidate(jsHash: string): void {
83
+ public invalidate(jsHash: string): void {
84
84
  this.#cache.delete(jsHash);
85
85
  }
86
86
 
@@ -180,7 +180,7 @@ export class WidgetBinding<T extends ModelState = ModelState> {
180
180
  * `controller`'s signal. Aborting the controller mid-initialize
181
181
  * still runs any legacy cleanup callback, and `create` rejects.
182
182
  */
183
- static async create<T extends ModelState>({
183
+ public static async create<T extends ModelState>({
184
184
  widgetDef,
185
185
  model,
186
186
  createHost,
@@ -261,7 +261,7 @@ export class WidgetBinding<T extends ModelState = ModelState> {
261
261
  * The object returned from `initialize`, or `undefined` if it
262
262
  * returned a cleanup function or nothing.
263
263
  */
264
- get exports(): unknown {
264
+ public get exports(): unknown {
265
265
  return this.#exports;
266
266
  }
267
267
 
@@ -273,7 +273,7 @@ export class WidgetBinding<T extends ModelState = ModelState> {
273
273
  * `render` reads current state via `model.get`; change listeners
274
274
  * observe only subsequent changes, matching Jupyter semantics.
275
275
  */
276
- async createView(
276
+ public async createView(
277
277
  target: { el: HTMLElement },
278
278
  options: { signal: AbortSignal },
279
279
  ): Promise<void> {
@@ -346,7 +346,7 @@ export class WidgetBinding<T extends ModelState = ModelState> {
346
346
  * Destroy this generation, running initialize/render cleanups and
347
347
  * clearing listeners registered through its model proxies.
348
348
  */
349
- async destroy(): Promise<void> {
349
+ public async destroy(): Promise<void> {
350
350
  Logger.debug("[WidgetBinding] Destroying binding generation");
351
351
  this.#controller.abort();
352
352
  await Promise.allSettled(this.#viewTasks);
@@ -11,9 +11,9 @@ import {
11
11
  } from "./matplotlib-renderer";
12
12
 
13
13
  export class MatplotlibPlugin implements IPlugin<T, Data> {
14
- tagName = "marimo-matplotlib";
14
+ public tagName = "marimo-matplotlib";
15
15
 
16
- validator = z.object({
16
+ public validator = z.object({
17
17
  chartBase64: z.string(),
18
18
  xBounds: z.tuple([z.number(), z.number()]),
19
19
  yBounds: z.tuple([z.number(), z.number()]),
@@ -28,7 +28,7 @@ export class MatplotlibPlugin implements IPlugin<T, Data> {
28
28
  yScale: z.enum(["linear", "log"]).default("linear"),
29
29
  });
30
30
 
31
- render(props: IPluginProps<T, Data>): JSX.Element {
31
+ public render(props: IPluginProps<T, Data>): JSX.Element {
32
32
  return (
33
33
  <MatplotlibComponent
34
34
  {...props.data}
@@ -228,8 +228,8 @@ function stubSyncImage() {
228
228
  vi.stubGlobal(
229
229
  "Image",
230
230
  class {
231
- onload: (() => void) | null = null;
232
- set src(_value: string) {
231
+ public onload: (() => void) | null = null;
232
+ public set src(_value: string) {
233
233
  this.onload?.();
234
234
  }
235
235
  },
@@ -284,7 +284,7 @@ export class MatplotlibRenderer {
284
284
  /** The devicePixelRatio the canvas buffer was last sized with. */
285
285
  #backingDpr = 1;
286
286
 
287
- constructor(
287
+ public constructor(
288
288
  container: HTMLDivElement,
289
289
  options: { state: MatplotlibState; signal: AbortSignal },
290
290
  ) {
@@ -396,7 +396,7 @@ export class MatplotlibRenderer {
396
396
  mq.addEventListener("change", onChange, { once: true, signal });
397
397
  }
398
398
 
399
- update(state: MatplotlibState): void {
399
+ public update(state: MatplotlibState): void {
400
400
  const prev = this.#state;
401
401
  this.#state = state;
402
402
 
@@ -10,14 +10,14 @@
10
10
  * - onopen / onmessage / onclose callbacks
11
11
  */
12
12
  export class MplCommWebSocket {
13
- readyState: number = WebSocket.OPEN;
13
+ public readyState: number = WebSocket.OPEN;
14
14
  private sendFn: (msg: unknown) => void;
15
15
 
16
- onopen: (() => void) | null = null;
17
- onmessage: ((evt: MessageEvent) => void) | null = null;
18
- onclose: (() => void) | null = null;
16
+ public onopen: (() => void) | null = null;
17
+ public onmessage: ((evt: MessageEvent) => void) | null = null;
18
+ public onclose: (() => void) | null = null;
19
19
 
20
- constructor(sendFn: (msg: unknown) => void) {
20
+ public constructor(sendFn: (msg: unknown) => void) {
21
21
  this.sendFn = sendFn;
22
22
  }
23
23
 
@@ -27,7 +27,7 @@ export class MplCommWebSocket {
27
27
  * socket instance stays bound to mpl.js (which wires `onopen`/`onmessage`
28
28
  * onto it at construction); only the comm behind it changes.
29
29
  */
30
- setSendHandler(sendFn: (msg: unknown) => void): void {
30
+ public setSendHandler(sendFn: (msg: unknown) => void): void {
31
31
  this.sendFn = sendFn;
32
32
  }
33
33
 
@@ -35,14 +35,14 @@ export class MplCommWebSocket {
35
35
  * Called by mpl.js to send a message to the backend.
36
36
  * mpl.js always sends JSON strings.
37
37
  */
38
- send(data: string): void {
38
+ public send(data: string): void {
39
39
  this.sendFn(JSON.parse(data));
40
40
  }
41
41
 
42
42
  /**
43
43
  * Called when the backend pushes a JSON message via the model custom event.
44
44
  */
45
- receiveJson(data: unknown): void {
45
+ public receiveJson(data: unknown): void {
46
46
  this.onmessage?.(
47
47
  new MessageEvent("message", { data: JSON.stringify(data) }),
48
48
  );
@@ -51,7 +51,7 @@ export class MplCommWebSocket {
51
51
  /**
52
52
  * Called when the backend pushes binary data (PNG render) via model custom event.
53
53
  */
54
- receiveBinary(buffer: DataView): void {
54
+ public receiveBinary(buffer: DataView): void {
55
55
  const ab = buffer.buffer.slice(
56
56
  buffer.byteOffset,
57
57
  buffer.byteOffset + buffer.byteLength,
@@ -60,7 +60,7 @@ export class MplCommWebSocket {
60
60
  this.onmessage?.(new MessageEvent("message", { data: blob }));
61
61
  }
62
62
 
63
- close(): void {
63
+ public close(): void {
64
64
  this.readyState = WebSocket.CLOSED;
65
65
  this.onclose?.();
66
66
  }
@@ -60,12 +60,12 @@ export class EventBuffer<T> {
60
60
  private processEvents: () => void;
61
61
  private blockDuration: number;
62
62
 
63
- constructor(processEvents: () => void, blockDuration = 200) {
63
+ public constructor(processEvents: () => void, blockDuration = 200) {
64
64
  this.processEvents = processEvents;
65
65
  this.blockDuration = blockDuration;
66
66
  }
67
67
 
68
- add(event: T) {
68
+ public add(event: T) {
69
69
  this.buffer.push(event);
70
70
  this.flush();
71
71
  }
@@ -90,15 +90,15 @@ export class EventBuffer<T> {
90
90
  }, this.blockDuration);
91
91
  }
92
92
 
93
- size() {
93
+ public size() {
94
94
  return this.buffer.length;
95
95
  }
96
96
 
97
- clear() {
97
+ public clear() {
98
98
  this.buffer = [];
99
99
  }
100
100
 
101
- getAndClear() {
101
+ public getAndClear() {
102
102
  const events = this.buffer;
103
103
  this.buffer = [];
104
104
  return events;
@@ -55,9 +55,9 @@ type T =
55
55
  | undefined;
56
56
 
57
57
  export class PlotlyPlugin implements IPlugin<T, Data> {
58
- tagName = "marimo-plotly";
58
+ public tagName = "marimo-plotly";
59
59
 
60
- validator = z.object({
60
+ public validator = z.object({
61
61
  figure: z
62
62
  .object({})
63
63
  .passthrough()
@@ -65,7 +65,7 @@ export class PlotlyPlugin implements IPlugin<T, Data> {
65
65
  config: z.object({}).passthrough(),
66
66
  });
67
67
 
68
- render(props: IPluginProps<T, Data>): JSX.Element {
68
+ public render(props: IPluginProps<T, Data>): JSX.Element {
69
69
  return (
70
70
  <PlotlyComponent
71
71
  {...props.data}
@@ -12,9 +12,9 @@ import React, { type JSX } from "react";
12
12
  const LazyVegaComponent = React.lazy(() => import("./vega-component"));
13
13
 
14
14
  export class VegaPlugin implements IPlugin<VegaComponentState, Data> {
15
- tagName = "marimo-vega";
15
+ public tagName = "marimo-vega";
16
16
 
17
- validator = z.object({
17
+ public validator = z.object({
18
18
  spec: z
19
19
  .object({})
20
20
  .passthrough()
@@ -26,7 +26,7 @@ export class VegaPlugin implements IPlugin<VegaComponentState, Data> {
26
26
  embedOptions: z.object({}).passthrough().default({}),
27
27
  });
28
28
 
29
- render(props: IPluginProps<VegaComponentState, Data>): JSX.Element {
29
+ public render(props: IPluginProps<VegaComponentState, Data>): JSX.Element {
30
30
  return (
31
31
  <LazyVegaComponent
32
32
  value={props.value}