@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
@@ -42,7 +42,7 @@ class Snapshotter {
42
42
  codes: Record<CellId, string>;
43
43
  };
44
44
 
45
- constructor(
45
+ public constructor(
46
46
  getNotebookCode: () => {
47
47
  cellIds: CellId[];
48
48
  codes: Record<CellId, string>;
@@ -226,7 +226,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
226
226
  private latestDiagnosticsVersion: number | null = null;
227
227
  private forwardedDiagnosticsVersion = 0;
228
228
 
229
- constructor(
229
+ public constructor(
230
230
  client: ILanguageServerClient,
231
231
  initialSettings: Record<string, unknown>,
232
232
  getNotebookEditors: () => Record<
@@ -254,7 +254,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
254
254
  this.snapshotter = new Snapshotter(this.getNotebookCode.bind(this));
255
255
  }
256
256
 
257
- onNotification(
257
+ public onNotification(
258
258
  listener: (n: {
259
259
  jsonrpc: "2.0";
260
260
  id?: null | undefined;
@@ -265,44 +265,44 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
265
265
  return this.client.onNotification(listener);
266
266
  }
267
267
 
268
- get ready(): boolean {
268
+ public get ready(): boolean {
269
269
  return this.client.ready;
270
270
  }
271
271
 
272
- set ready(value: boolean) {
272
+ public set ready(value: boolean) {
273
273
  this.client.ready = value;
274
274
  }
275
275
 
276
- get capabilities(): LSP.ServerCapabilities | null {
276
+ public get capabilities(): LSP.ServerCapabilities | null {
277
277
  return this.client.capabilities;
278
278
  }
279
279
 
280
- set capabilities(value: LSP.ServerCapabilities) {
280
+ public set capabilities(value: LSP.ServerCapabilities) {
281
281
  this.client.capabilities = value;
282
282
  }
283
283
 
284
- get initializePromise(): Promise<void> {
284
+ public get initializePromise(): Promise<void> {
285
285
  return this.client.initializePromise;
286
286
  }
287
287
 
288
- set initializePromise(value: Promise<void>) {
288
+ public set initializePromise(value: Promise<void>) {
289
289
  this.client.initializePromise = value;
290
290
  }
291
291
 
292
- get clientCapabilities() {
292
+ public get clientCapabilities() {
293
293
  return this.client.clientCapabilities;
294
294
  }
295
295
 
296
- async initialize(): Promise<void> {
296
+ public async initialize(): Promise<void> {
297
297
  await this.client.initialize();
298
298
  }
299
299
 
300
- close(): void {
300
+ public close(): void {
301
301
  this.openCellDocumentCounts.clear();
302
302
  this.client.close();
303
303
  }
304
304
 
305
- hasCapability(method: string): boolean {
305
+ public hasCapability(method: string): boolean {
306
306
  return this.client.hasCapability(method);
307
307
  }
308
308
 
@@ -430,7 +430,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
430
430
  * This ensures the caller uses the same lens that was sent to the server,
431
431
  * avoiding race conditions if cells change between sync and subsequent operations.
432
432
  */
433
- async sync(): Promise<{
433
+ public async sync(): Promise<{
434
434
  params: LSP.DidChangeTextDocumentParams;
435
435
  lens: NotebookLens;
436
436
  }> {
@@ -499,7 +499,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
499
499
  });
500
500
  }
501
501
 
502
- async textDocumentDefinition(
502
+ public async textDocumentDefinition(
503
503
  params: LSP.DefinitionParams,
504
504
  ): Promise<LSP.Definition | LSP.LocationLink[] | null> {
505
505
  // Get the cell document URI from the params
@@ -525,7 +525,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
525
525
  });
526
526
  }
527
527
 
528
- async textDocumentSignatureHelp(
528
+ public async textDocumentSignatureHelp(
529
529
  params: LSP.SignatureHelpParams,
530
530
  ): Promise<LSP.SignatureHelp | null> {
531
531
  const cellDocumentUri = params.textDocument.uri;
@@ -572,7 +572,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
572
572
  *
573
573
  * See textDocumentRename for a similar workaround that manually applies edits.
574
574
  */
575
- textDocumentCodeAction(
575
+ public textDocumentCodeAction(
576
576
  params: LSP.CodeActionParams,
577
577
  ): Promise<(LSP.Command | LSP.CodeAction)[] | null> {
578
578
  const disabledCodeAction = true;
@@ -582,7 +582,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
582
582
  return this.client.textDocumentCodeAction(params);
583
583
  }
584
584
 
585
- codeActionResolve(action: LSP.CodeAction): Promise<LSP.CodeAction> {
585
+ public codeActionResolve(action: LSP.CodeAction): Promise<LSP.CodeAction> {
586
586
  return Promise.resolve(action);
587
587
  }
588
588
 
@@ -646,7 +646,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
646
646
  * LSP edit application flow. The trade-off is that we lose undo grouping
647
647
  * across cells.
648
648
  */
649
- async textDocumentRename(
649
+ public async textDocumentRename(
650
650
  params: LSP.RenameParams,
651
651
  ): Promise<LSP.WorkspaceEdit | null> {
652
652
  // Get the cell document URI from the params
@@ -784,7 +784,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
784
784
  };
785
785
  }
786
786
 
787
- async completionItemResolve(
787
+ public async completionItemResolve(
788
788
  params: LSP.CompletionItem,
789
789
  ): Promise<LSP.CompletionItem> {
790
790
  // Used cached result to avoid jitter while typing in the same completion item
@@ -801,7 +801,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
801
801
  return resolved;
802
802
  }
803
803
 
804
- async textDocumentPrepareRename(
804
+ public async textDocumentPrepareRename(
805
805
  params: LSP.PrepareRenameParams,
806
806
  ): Promise<LSP.PrepareRenameResult | null> {
807
807
  // Get the cell document URI from the params
@@ -66,11 +66,11 @@ describe("dnd", () => {
66
66
  });
67
67
 
68
68
  class DragEvent extends Event {
69
- dataTransfer: DataTransfer;
70
- clientX: number;
71
- clientY: number;
69
+ public dataTransfer: DataTransfer;
70
+ public clientX: number;
71
+ public clientY: number;
72
72
 
73
- constructor(
73
+ public constructor(
74
74
  type: string,
75
75
  {
76
76
  dataTransfer,
@@ -86,14 +86,14 @@ class DragEvent extends Event {
86
86
  }
87
87
 
88
88
  class DataTransfer {
89
- data: Record<string, string> = {};
90
- _items: File[] = [];
89
+ public data: Record<string, string> = {};
90
+ public _items: File[] = [];
91
91
 
92
- setData(type: string, data: string) {
92
+ public setData(type: string, data: string) {
93
93
  this.data[type] = data;
94
94
  }
95
95
 
96
- get items() {
96
+ public get items() {
97
97
  return {
98
98
  add: (file: File) => {
99
99
  this._items.push(file);
@@ -101,11 +101,11 @@ class DataTransfer {
101
101
  };
102
102
  }
103
103
 
104
- get files() {
104
+ public get files() {
105
105
  return this._items;
106
106
  }
107
107
 
108
- getData(type: string) {
108
+ public getData(type: string) {
109
109
  return this.data[type];
110
110
  }
111
111
  }
@@ -320,17 +320,20 @@ def foo():
320
320
  // Mock ClipboardEvent and DataTransfer
321
321
  class MockDataTransfer {
322
322
  private data: Record<string, string> = {};
323
- setData(format: string, data: string) {
323
+ public setData(format: string, data: string) {
324
324
  this.data[format] = data;
325
325
  }
326
- getData(format: string) {
326
+ public getData(format: string) {
327
327
  return this.data[format];
328
328
  }
329
329
  }
330
330
 
331
331
  class MockClipboardEvent extends Event {
332
- clipboardData: MockDataTransfer;
333
- constructor(type: string, init?: { clipboardData?: MockDataTransfer }) {
332
+ public clipboardData: MockDataTransfer;
333
+ public constructor(
334
+ type: string,
335
+ init?: { clipboardData?: MockDataTransfer },
336
+ ) {
334
337
  super(type);
335
338
  this.clipboardData = init?.clipboardData || new MockDataTransfer();
336
339
  }
@@ -50,7 +50,7 @@ class ReactiveReferencesPlugin {
50
50
  // Debounced function to trigger highlighting
51
51
  private readonly scheduleHighlighting: DebouncedFunc<() => void>;
52
52
 
53
- constructor(view: EditorView, cellId: CellId) {
53
+ public constructor(view: EditorView, cellId: CellId) {
54
54
  this.view = view;
55
55
  this.cellId = cellId;
56
56
 
@@ -67,13 +67,13 @@ class ReactiveReferencesPlugin {
67
67
  this.scheduleHighlighting();
68
68
  }
69
69
 
70
- update(update: ViewUpdate) {
70
+ public update(update: ViewUpdate) {
71
71
  if (update.docChanged || update.focusChanged) {
72
72
  this.scheduleHighlighting();
73
73
  }
74
74
  }
75
75
 
76
- destroy() {
76
+ public destroy() {
77
77
  this.scheduleHighlighting.cancel();
78
78
  this.variablesUnsubscribe();
79
79
  }
@@ -208,7 +208,7 @@ export class RemoteCursorMarker implements LayerMarker {
208
208
  private name: string;
209
209
  private colorClassName: string;
210
210
 
211
- constructor(
211
+ public constructor(
212
212
  left: number,
213
213
  top: number,
214
214
  height: number,
@@ -222,18 +222,18 @@ export class RemoteCursorMarker implements LayerMarker {
222
222
  this.colorClassName = colorClassName;
223
223
  }
224
224
 
225
- draw(): HTMLElement {
225
+ public draw(): HTMLElement {
226
226
  const elt = document.createElement("div");
227
227
  this.adjust(elt);
228
228
  return elt;
229
229
  }
230
230
 
231
- update(elt: HTMLElement): boolean {
231
+ public update(elt: HTMLElement): boolean {
232
232
  this.adjust(elt);
233
233
  return true;
234
234
  }
235
235
 
236
- adjust(element: HTMLElement) {
236
+ public adjust(element: HTMLElement) {
237
237
  element.style.left = `${this.left}px`;
238
238
  element.style.top = `${this.top}px`;
239
239
  element.style.height = `${this.height}px`;
@@ -241,7 +241,7 @@ export class RemoteCursorMarker implements LayerMarker {
241
241
  element.style.setProperty("--rtc-name", `"${this.name}"`);
242
242
  }
243
243
 
244
- eq(other: RemoteCursorMarker): boolean {
244
+ public eq(other: RemoteCursorMarker): boolean {
245
245
  return (
246
246
  this.left === other.left &&
247
247
  this.top === other.top &&
@@ -364,7 +364,7 @@ export interface CursorPosition {
364
364
  }
365
365
 
366
366
  export class AwarenessPlugin implements PluginValue {
367
- sub: Subscription;
367
+ public sub: Subscription;
368
368
  public view: EditorView;
369
369
  public doc: LoroDoc;
370
370
  public user: UserState;
@@ -373,7 +373,7 @@ export class AwarenessPlugin implements PluginValue {
373
373
  private scopeId: ScopeId;
374
374
  private getUserId?: () => Uid;
375
375
 
376
- constructor(
376
+ public constructor(
377
377
  view: EditorView,
378
378
  doc: LoroDoc,
379
379
  user: UserState,
@@ -421,7 +421,7 @@ export class AwarenessPlugin implements PluginValue {
421
421
  });
422
422
  }
423
423
 
424
- update(update: ViewUpdate): void {
424
+ public update(update: ViewUpdate): void {
425
425
  if (!update.selectionSet && !update.focusChanged && !update.docChanged) {
426
426
  return;
427
427
  }
@@ -450,7 +450,7 @@ export class AwarenessPlugin implements PluginValue {
450
450
  }
451
451
  }
452
452
 
453
- destroy(): void {
453
+ public destroy(): void {
454
454
  this.sub?.();
455
455
  this.awareness.setLocalState({
456
456
  type: "delete",
@@ -460,13 +460,13 @@ export class AwarenessPlugin implements PluginValue {
460
460
  }
461
461
  }
462
462
  export class RemoteAwarenessPlugin implements PluginValue {
463
- _awarenessListener?: AwarenessListener;
463
+ public _awarenessListener?: AwarenessListener;
464
464
  public view: EditorView;
465
465
  public doc: LoroDoc;
466
466
  public awareness: Awareness<AwarenessState>;
467
467
  private scopeId: ScopeId;
468
468
 
469
- constructor(
469
+ public constructor(
470
470
  view: EditorView,
471
471
  doc: LoroDoc,
472
472
  awareness: Awareness<AwarenessState>,
@@ -493,7 +493,7 @@ export class RemoteAwarenessPlugin implements PluginValue {
493
493
  this.awareness.addListener(listener);
494
494
  }
495
495
 
496
- destroy(): void {
496
+ public destroy(): void {
497
497
  if (this._awarenessListener) {
498
498
  this.awareness.removeListener(this._awarenessListener);
499
499
  }
@@ -38,14 +38,14 @@ export const loroSyncPlugin = (
38
38
  export const loroSyncAnnotation = Annotation.define();
39
39
 
40
40
  export class LoroSyncPluginValue implements PluginValue {
41
- sub?: Subscription;
41
+ public sub?: Subscription;
42
42
  private isInitDispatch = false;
43
43
  private view: EditorView;
44
44
  private doc: LoroDoc;
45
45
  private docPath: string[];
46
46
  private getTextFromDoc: (doc: LoroDoc) => LoroText;
47
47
 
48
- constructor(
48
+ public constructor(
49
49
  view: EditorView,
50
50
  doc: LoroDoc,
51
51
  docPath: string[],
@@ -77,7 +77,7 @@ export class LoroSyncPluginValue implements PluginValue {
77
77
  });
78
78
  }
79
79
 
80
- onRemoteUpdate = (e: LoroEventBatch) => {
80
+ public onRemoteUpdate = (e: LoroEventBatch) => {
81
81
  if (e.by === "local") {
82
82
  return;
83
83
  }
@@ -133,7 +133,7 @@ export class LoroSyncPluginValue implements PluginValue {
133
133
  }
134
134
  };
135
135
 
136
- update(update: ViewUpdate): void {
136
+ public update(update: ViewUpdate): void {
137
137
  if (this.isInitDispatch) {
138
138
  this.isInitDispatch = false;
139
139
  return;
@@ -161,7 +161,7 @@ export class LoroSyncPluginValue implements PluginValue {
161
161
  this.doc.commit();
162
162
  }
163
163
 
164
- destroy(): void {
164
+ public destroy(): void {
165
165
  this.sub?.();
166
166
  this.sub = undefined;
167
167
  }
@@ -23,7 +23,7 @@ export class VimCursorVisibilityPlugin implements PluginValue {
23
23
  private view: EditorView;
24
24
  private abortController = new AbortController();
25
25
 
26
- constructor(options: VimCursorVisibilityPluginOptions) {
26
+ public constructor(options: VimCursorVisibilityPluginOptions) {
27
27
  this.view = options.view;
28
28
  this.view.dom.addEventListener(
29
29
  "focus",
@@ -38,7 +38,7 @@ export class VimCursorVisibilityPlugin implements PluginValue {
38
38
  this.update();
39
39
  }
40
40
 
41
- update() {
41
+ public update() {
42
42
  const vimCursorLayer = this.view.dom.querySelector(".cm-vimCursorLayer");
43
43
  if (vimCursorLayer instanceof HTMLElement) {
44
44
  // Hide all vim cursors when in command mode
@@ -52,7 +52,7 @@ export class VimCursorVisibilityPlugin implements PluginValue {
52
52
  }
53
53
  }
54
54
 
55
- destroy(): void {
55
+ public destroy(): void {
56
56
  this.abortController.abort();
57
57
  }
58
58
  }
@@ -137,7 +137,7 @@ export function initializeUIElement() {
137
137
  this.initialized = true;
138
138
  }
139
139
 
140
- connectedCallback() {
140
+ public connectedCallback() {
141
141
  this.init();
142
142
 
143
143
  if (this.initialized) {
@@ -157,7 +157,7 @@ export function initializeUIElement() {
157
157
  }
158
158
  }
159
159
 
160
- disconnectedCallback() {
160
+ public disconnectedCallback() {
161
161
  if (this.initialized) {
162
162
  // Unregister everything
163
163
  document.removeEventListener(
@@ -175,7 +175,7 @@ export function initializeUIElement() {
175
175
  /**
176
176
  * Reset the value of the child element to its initial value.
177
177
  */
178
- reset() {
178
+ public reset() {
179
179
  const child = this.firstElementChild;
180
180
  if (isCustomMarimoElement(child)) {
181
181
  child.reset();
@@ -189,11 +189,11 @@ export function initializeUIElement() {
189
189
  // We look for changes to the random-id attribute, which is effectively
190
190
  // used like a React key. If the random-id changes, we need to unmount and
191
191
  // remount its child.
192
- static get observedAttributes() {
192
+ public static get observedAttributes() {
193
193
  return [RANDOM_ID_ATTR];
194
194
  }
195
195
 
196
- attributeChangedCallback(
196
+ public attributeChangedCallback(
197
197
  name: string,
198
198
  oldValue: string | null,
199
199
  newValue: string | null,
@@ -45,12 +45,12 @@ interface UIElementEntry {
45
45
  */
46
46
  export class UIElementRegistry {
47
47
  // maps UIElement objectIds to entries.
48
- entries: Map<UIElementId, UIElementEntry>;
48
+ public entries: Map<UIElementId, UIElementEntry>;
49
49
 
50
50
  /**
51
51
  * Shared instance of UIElementRegistry since this must be a singleton.
52
52
  */
53
- static get INSTANCE(): UIElementRegistry {
53
+ public static get INSTANCE(): UIElementRegistry {
54
54
  const KEY = "_marimo_private_UIElementRegistry";
55
55
  if (!window[KEY]) {
56
56
  window[KEY] = new UIElementRegistry();
@@ -62,11 +62,11 @@ export class UIElementRegistry {
62
62
  this.entries = new Map();
63
63
  }
64
64
 
65
- has(objectId: UIElementId): boolean {
65
+ public has(objectId: UIElementId): boolean {
66
66
  return this.entries.has(objectId);
67
67
  }
68
68
 
69
- set(objectId: UIElementId, value: ValueType): void {
69
+ public set(objectId: UIElementId, value: ValueType): void {
70
70
  if (this.entries.has(objectId)) {
71
71
  Logger.debug(
72
72
  "UIElementRegistry overwriting entry for objectId.",
@@ -86,7 +86,7 @@ export class UIElementRegistry {
86
86
  * @param objectId - id of the UIElement
87
87
  * @param instance - the HTMLElement that the UIElement wraps
88
88
  */
89
- registerInstance(objectId: UIElementId, instance: HTMLElement) {
89
+ public registerInstance(objectId: UIElementId, instance: HTMLElement) {
90
90
  const entry = this.entries.get(objectId);
91
91
  if (entry === undefined) {
92
92
  this.entries.set(objectId, {
@@ -109,7 +109,7 @@ export class UIElementRegistry {
109
109
  * @param instance - the HTMLElement to remove
110
110
  *
111
111
  */
112
- removeInstance(objectId: UIElementId, instance: HTMLElement) {
112
+ public removeInstance(objectId: UIElementId, instance: HTMLElement) {
113
113
  const entry = this.entries.get(objectId);
114
114
  // The UIElement can be removed from the registry before all
115
115
  // instances are removed: UIElement removal is triggered
@@ -129,7 +129,7 @@ export class UIElementRegistry {
129
129
  *
130
130
  * @param cellId - stringified cellId
131
131
  */
132
- removeElementsByCell(cellId: CellId) {
132
+ public removeElementsByCell(cellId: CellId) {
133
133
  const objectIds = [...this.entries.keys()].filter((objectId) =>
134
134
  objectId.startsWith(`${cellId}-`),
135
135
  );
@@ -145,12 +145,12 @@ export class UIElementRegistry {
145
145
  * @param objectId - id of the UIElement
146
146
  * @returns the value for `objectId`, or `undefined` if the object was not found.
147
147
  */
148
- lookupValue(objectId: UIElementId): ValueType {
148
+ public lookupValue(objectId: UIElementId): ValueType {
149
149
  const entry = this.entries.get(objectId);
150
150
  return entry === undefined ? undefined : entry.value;
151
151
  }
152
152
 
153
- broadcastMessage(
153
+ public broadcastMessage(
154
154
  objectId: UIElementId,
155
155
  message: unknown,
156
156
  buffers: readonly DataView[],
@@ -202,7 +202,7 @@ export class UIElementRegistry {
202
202
  * @param objectId - id of the UIElement
203
203
  * @param value - value to broadcast
204
204
  */
205
- broadcastValueUpdate(
205
+ public broadcastValueUpdate(
206
206
  initiator: HTMLElement,
207
207
  objectId: UIElementId,
208
208
  value: ValueType,
@@ -510,13 +510,13 @@ export class HotkeyProvider implements IHotkeyProvider {
510
510
  /**
511
511
  * @param platform - See {@link HotkeyProviderOptions.platform}.
512
512
  */
513
- static create(platform?: Platform): HotkeyProvider {
513
+ public static create(platform?: Platform): HotkeyProvider {
514
514
  return new HotkeyProvider(DEFAULT_HOT_KEY, { platform });
515
515
  }
516
516
 
517
517
  private hotkeys: Record<HotkeyAction, Hotkey>;
518
518
 
519
- constructor(
519
+ public constructor(
520
520
  hotkeys: Record<HotkeyAction, Hotkey>,
521
521
  options: HotkeyProviderOptions = {},
522
522
  ) {
@@ -525,11 +525,11 @@ export class HotkeyProvider implements IHotkeyProvider {
525
525
  this.mod = this.platform === "mac" ? "Cmd" : "Ctrl";
526
526
  }
527
527
 
528
- iterate(): HotkeyAction[] {
528
+ public iterate(): HotkeyAction[] {
529
529
  return Objects.keys(this.hotkeys);
530
530
  }
531
531
 
532
- getHotkey(action: HotkeyAction): ResolvedHotkey {
532
+ public getHotkey(action: HotkeyAction): ResolvedHotkey {
533
533
  const { name, key, additionalKeywords } = this.hotkeys[action];
534
534
  if (typeof key === "string") {
535
535
  return {
@@ -553,15 +553,15 @@ export class HotkeyProvider implements IHotkeyProvider {
553
553
  };
554
554
  }
555
555
 
556
- getHotkeyDisplay(action: HotkeyAction): string {
556
+ public getHotkeyDisplay(action: HotkeyAction): string {
557
557
  return this.hotkeys[action].name;
558
558
  }
559
559
 
560
- isEditable(action: HotkeyAction): boolean {
560
+ public isEditable(action: HotkeyAction): boolean {
561
561
  return this.hotkeys[action].editable !== false;
562
562
  }
563
563
 
564
- getHotkeyGroups(): Record<HotkeyGroup, HotkeyAction[]> {
564
+ public getHotkeyGroups(): Record<HotkeyGroup, HotkeyAction[]> {
565
565
  return Objects.groupBy(
566
566
  Objects.entries(this.hotkeys),
567
567
  ([, hotkey]) => hotkey.group,
@@ -573,7 +573,7 @@ export class HotkeyProvider implements IHotkeyProvider {
573
573
  export class OverridingHotkeyProvider extends HotkeyProvider {
574
574
  private readonly overrides: Partial<Record<HotkeyAction, string | undefined>>;
575
575
 
576
- constructor(
576
+ public constructor(
577
577
  overrides: Partial<Record<HotkeyAction, string | undefined>>,
578
578
  options: HotkeyProviderOptions = {},
579
579
  ) {
@@ -581,7 +581,7 @@ export class OverridingHotkeyProvider extends HotkeyProvider {
581
581
  this.overrides = overrides;
582
582
  }
583
583
 
584
- override getHotkey(action: HotkeyAction): ResolvedHotkey {
584
+ public override getHotkey(action: HotkeyAction): ResolvedHotkey {
585
585
  const base = super.getHotkey(action);
586
586
  const override = this.overrides[action];
587
587
  return {
@@ -38,12 +38,12 @@ vi.stubGlobal(
38
38
 
39
39
  // Create a mock URL class that works as a constructor
40
40
  class MockURL {
41
- href: string;
42
- constructor(url: string, base?: string | URL) {
41
+ public href: string;
42
+ public constructor(url: string, base?: string | URL) {
43
43
  this.href = base ? `${base}/${url}` : url;
44
44
  }
45
- static createObjectURL = vi.fn(() => "blob:mock-url");
46
- static revokeObjectURL = vi.fn();
45
+ public static createObjectURL = vi.fn(() => "blob:mock-url");
46
+ public static revokeObjectURL = vi.fn();
47
47
  }
48
48
  vi.stubGlobal("URL", MockURL);
49
49
 
@@ -236,11 +236,11 @@ export class MockWorkerFactory implements WorkerFactory {
236
236
  public workers: Worker[] = [];
237
237
  private readonly mockWorker?: Worker;
238
238
 
239
- constructor(mockWorker?: Worker) {
239
+ public constructor(mockWorker?: Worker) {
240
240
  this.mockWorker = mockWorker;
241
241
  }
242
242
 
243
- create(): Worker {
243
+ public create(): Worker {
244
244
  const worker = this.mockWorker || this.createMockWorker();
245
245
  this.workers.push(worker);
246
246
  return worker;
@@ -259,11 +259,11 @@ export class MockWorkerFactory implements WorkerFactory {
259
259
  } as unknown as Worker;
260
260
  }
261
261
 
262
- getCreatedWorkers(): Worker[] {
262
+ public getCreatedWorkers(): Worker[] {
263
263
  return this.workers;
264
264
  }
265
265
 
266
- terminateAll(): void {
266
+ public terminateAll(): void {
267
267
  for (const worker of this.workers) {
268
268
  worker.terminate();
269
269
  }