@marimo-team/islands 0.19.8-dev5 → 0.19.8-dev50

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 (147) hide show
  1. package/dist/{Combination-Bg-xN8JV.js → Combination-BTMrlhzT.js} +11 -10
  2. package/dist/{ConnectedDataExplorerComponent-DewsKLl2.js → ConnectedDataExplorerComponent-BAeQ8DWw.js} +11 -11
  3. package/dist/{ImageComparisonComponent-Bijp8beW.js → ImageComparisonComponent-DkEXPki_.js} +2 -2
  4. package/dist/{any-language-editor-DZc6NCTp.js → any-language-editor-D0UQItkS.js} +6 -6
  5. package/dist/{architectureDiagram-VXUJARFQ--NkyBn9Y.js → architectureDiagram-VXUJARFQ-DPPYVq8H.js} +4 -4
  6. package/dist/assets/__vite-browser-external-WSlCcXn_.js +1 -0
  7. package/dist/assets/worker-DUYMdbtA.js +73 -0
  8. package/dist/{blockDiagram-VD42YOAC-DEZZaTW0.js → blockDiagram-VD42YOAC-BA5N05Y9.js} +4 -4
  9. package/dist/{button-BWvsJ2Wr.js → button-Cy0ElmIm.js} +2 -2
  10. package/dist/{c4Diagram-YG6GDRKO-Bj7hwWCO.js → c4Diagram-YG6GDRKO-DJLzuGJJ.js} +3 -3
  11. package/dist/{channel-B_QrFrGg.js → channel-Dob5kWXR.js} +1 -1
  12. package/dist/{check-CM_kewwn.js → check-DkNR52Mm.js} +1 -1
  13. package/dist/{chunk-5FQGJX7Z-D5VFKHmt.js → chunk-5FQGJX7Z-BEb20Lzt.js} +3 -3
  14. package/dist/{chunk-ABZYJK2D-SZPYmRzN.js → chunk-ABZYJK2D-BXTC53mt.js} +1 -1
  15. package/dist/{chunk-ATLVNIR6-BI_WwH1o.js → chunk-ATLVNIR6-BJDjUR_c.js} +1 -1
  16. package/dist/{chunk-B4BG7PRW-BlI9Gm1l.js → chunk-B4BG7PRW-DzmUUpfH.js} +4 -4
  17. package/dist/{chunk-DI55MBZ5-BXxemMn5.js → chunk-DI55MBZ5-gTd3J8Tu.js} +4 -4
  18. package/dist/{chunk-EXTU4WIE-CzWtDV99.js → chunk-EXTU4WIE-DyoOs5QX.js} +1 -1
  19. package/dist/{chunk-JA3XYJ7Z-DQ-2ARfa.js → chunk-JA3XYJ7Z-BGnAIbOP.js} +2 -2
  20. package/dist/{chunk-JZLCHNYA-CVfjf2vv.js → chunk-JZLCHNYA-CIRgweVQ.js} +4 -4
  21. package/dist/{chunk-N4CR4FBY-BCZvQ7Jq.js → chunk-N4CR4FBY-DKSvXAIS.js} +5 -5
  22. package/dist/{chunk-QN33PNHL-DY_2Q2zl.js → chunk-QN33PNHL-B6zC8BTi.js} +1 -1
  23. package/dist/{chunk-QXUST7PY-BMCjAVR_.js → chunk-QXUST7PY-C7750n_u.js} +5 -5
  24. package/dist/{chunk-S3R3BYOJ-Ddu0H4Qa.js → chunk-S3R3BYOJ-CBkH6JZZ.js} +1 -1
  25. package/dist/{chunk-TZMSLE5B-C2wVlbMl.js → chunk-TZMSLE5B-DObGL7xi.js} +1 -1
  26. package/dist/{classDiagram-2ON5EDUG-D-g7zbyO.js → classDiagram-2ON5EDUG-B9pkKjjc.js} +9 -9
  27. package/dist/{classDiagram-v2-WZHVMYZB-C7v5zNRD.js → classDiagram-v2-WZHVMYZB-CRhhA0tV.js} +9 -9
  28. package/dist/{click-outside-container-BCN5BtVO.js → click-outside-container-DNfggvIW.js} +1 -1
  29. package/dist/{code-block-37QAKDTI-eUgXqGNG.js → code-block-37QAKDTI-u5kgjqmr.js} +2 -2
  30. package/dist/{compiler-runtime-DHFVbq0b.js → compiler-runtime-B_OLMU9S.js} +1 -1
  31. package/dist/{copy-B59Bw3-w.js → copy-DRaXIb_a.js} +3 -3
  32. package/dist/{dagre-6UL2VRFP-DKIPL74O.js → dagre-6UL2VRFP-C2C2XxsB.js} +6 -6
  33. package/dist/{data-grid-overlay-editor-COyFwFmE.js → data-grid-overlay-editor-BXqtz1ia.js} +4 -4
  34. package/dist/{diagram-PSM6KHXK-CVTrAZaP.js → diagram-PSM6KHXK-DHBY-94p.js} +5 -5
  35. package/dist/{diagram-QEK2KX5R-BqHBzu3x.js → diagram-QEK2KX5R-CgMshOwn.js} +3 -3
  36. package/dist/{diagram-S2PKOQOG-CJD6owcg.js → diagram-S2PKOQOG-F1KPva3Y.js} +3 -3
  37. package/dist/{dist-Co5PD8Fb.js → dist-BBYTEAvO.js} +1 -1
  38. package/dist/{erDiagram-Q2GNP2WA-CqOceSf9.js → erDiagram-Q2GNP2WA-18gGng8V.js} +9 -9
  39. package/dist/{error-banner-C7KLpECd.js → error-banner-D2zjeN_a.js} +5 -5
  40. package/dist/{esm-D4WO8J3G.js → esm-CgRNPmz8.js} +6 -6
  41. package/dist/{flowDiagram-NV44I4VS-K7-DUifo.js → flowDiagram-NV44I4VS-iHFiHYe0.js} +9 -9
  42. package/dist/{ganttDiagram-JELNMOA3-BwUFY9Nu.js → ganttDiagram-JELNMOA3-D7GixxiF.js} +2 -2
  43. package/dist/{gitGraphDiagram-NY62KEGX-CjGRtLb1.js → gitGraphDiagram-NY62KEGX-CJFHytRK.js} +2 -2
  44. package/dist/{glide-data-editor-C3T7HsLi.js → glide-data-editor-BYwb17Bf.js} +13 -13
  45. package/dist/{infoDiagram-WHAUD3N6-DNhmDn-6.js → infoDiagram-WHAUD3N6-B5Lkh3A9.js} +2 -2
  46. package/dist/{journeyDiagram-XKPGCS4Q-BOdK47P8.js → journeyDiagram-XKPGCS4Q-CV_9R9iP.js} +2 -2
  47. package/dist/{kanban-definition-3W4ZIXB7-A0JC9d0g.js → kanban-definition-3W4ZIXB7-Dp21D5Ym.js} +6 -6
  48. package/dist/{katex-DJyOeQ91.js → katex-CX2BKujk.js} +1 -1
  49. package/dist/{katex-Dm9nZf6A.js → katex-Db0k5oV_.js} +1 -1
  50. package/dist/{label-C4PtQcza.js → label-CxU5JNBW.js} +6 -6
  51. package/dist/main.js +2000 -1887
  52. package/dist/mermaid-4DMBBIKO-BhDCqnO1.js +6 -0
  53. package/dist/{mermaid-Bqp2Xw99.js → mermaid-B__BZSXU.js} +39 -39
  54. package/dist/{mhchem-BqdXeZVX.js → mhchem-w1tkUnWr.js} +1 -1
  55. package/dist/{mindmap-definition-VGOIOE7T-CS6nKN_L.js → mindmap-definition-VGOIOE7T-B_5mfdYp.js} +8 -8
  56. package/dist/{number-overlay-editor-Bz_bDJQb.js → number-overlay-editor-D-4WQAGX.js} +2 -2
  57. package/dist/{pieDiagram-ADFJNKIX-DSa60Grk.js → pieDiagram-ADFJNKIX-B-DGEopK.js} +3 -3
  58. package/dist/{quadrantDiagram-AYHSOK5B-CFnMbP2J.js → quadrantDiagram-AYHSOK5B-M_yRSIZn.js} +1 -1
  59. package/dist/{react-DdA8EBol.js → react-Bs6Z0kvn.js} +1 -1
  60. package/dist/{react-dom-DJW8xUDg.js → react-dom-CqtLRVZP.js} +2 -2
  61. package/dist/{react-plotly-jVjTu07w.js → react-plotly-BuRa9xtI.js} +1 -1
  62. package/dist/{react-vega-DgHpnZ04.js → react-vega-3WcLHYC7.js} +2 -2
  63. package/dist/{react-vega-CjiPWyw0.js → react-vega-DLFvGrpJ.js} +1 -1
  64. package/dist/{requirementDiagram-UZGBJVZJ-ytLQrFTk.js → requirementDiagram-UZGBJVZJ-9Wt82hOZ.js} +8 -8
  65. package/dist/{sankeyDiagram-TZEHDZUN-KQqXDoky.js → sankeyDiagram-TZEHDZUN-x_aTXZeN.js} +1 -1
  66. package/dist/{sequenceDiagram-WL72ISMW-ByLI04T5.js → sequenceDiagram-WL72ISMW-CXXmJqiQ.js} +3 -3
  67. package/dist/{slides-component-BVjvNo92.js → slides-component-Dp-y50K9.js} +4 -4
  68. package/dist/{spec-Dmb1KfK3.js → spec-HoYHAQo2.js} +6 -6
  69. package/dist/{stateDiagram-FKZM4ZOC-Dfz8vBbP.js → stateDiagram-FKZM4ZOC-CiSKS_Mx.js} +9 -9
  70. package/dist/{stateDiagram-v2-4FDKWEC3-DRYoLdT5.js → stateDiagram-v2-4FDKWEC3-A43Itnjp.js} +9 -9
  71. package/dist/style.css +1 -1
  72. package/dist/{timeline-definition-IT6M3QCI-CO48XU1B.js → timeline-definition-IT6M3QCI-DR26eWb4.js} +1 -1
  73. package/dist/{types-CzEZ3EWT.js → types-Bb-6p8hv.js} +8 -8
  74. package/dist/{useAsyncData-BjNwqCfS.js → useAsyncData-Dyq3DyOF.js} +3 -3
  75. package/dist/{useDeepCompareMemoize-CfoxVor3.js → useDeepCompareMemoize-BhZZsis0.js} +12 -8
  76. package/dist/{useIframeCapabilities-BBO_R0ww.js → useIframeCapabilities-DurI5SJh.js} +2 -2
  77. package/dist/{useTheme-BYG2SH8J.js → useTheme-SlKl8MlS.js} +5 -6
  78. package/dist/{vega-component-rDX7xwxH.js → vega-component-DCxUyPnb.js} +10 -10
  79. package/dist/{xychartDiagram-PRI3JC2R-CUIfjNVD.js → xychartDiagram-PRI3JC2R-BcVxCRox.js} +4 -4
  80. package/dist/{zod-DITCj31F.js → zod-bjADtMKr.js} +3 -3
  81. package/package.json +18 -18
  82. package/src/components/app-config/ai-config.tsx +11 -2
  83. package/src/components/app-config/optional-features.tsx +1 -1
  84. package/src/components/app-config/user-config-form.tsx +0 -54
  85. package/src/components/chat/__tests__/useFileState.test.tsx +93 -0
  86. package/src/components/chat/acp/__tests__/state.test.ts +69 -0
  87. package/src/components/chat/acp/agent-panel.tsx +26 -77
  88. package/src/components/chat/acp/state.ts +6 -6
  89. package/src/components/chat/chat-components.tsx +114 -1
  90. package/src/components/chat/chat-panel.tsx +79 -134
  91. package/src/components/chat/chat-utils.ts +42 -0
  92. package/src/components/data-table/__tests__/data-table.test.tsx +94 -2
  93. package/src/components/editor/actions/useCellActionButton.tsx +14 -1
  94. package/src/components/editor/ai/add-cell-with-ai.tsx +85 -53
  95. package/src/components/editor/ai/ai-completion-editor.tsx +15 -38
  96. package/src/components/editor/cell/CreateCellButton.tsx +2 -1
  97. package/src/components/editor/cell/code/cell-editor.tsx +12 -0
  98. package/src/components/editor/chrome/panels/packages-panel.tsx +12 -9
  99. package/src/components/editor/database/__tests__/__snapshots__/as-code.test.ts.snap +15 -0
  100. package/src/components/editor/database/__tests__/as-code.test.ts +8 -0
  101. package/src/components/editor/database/as-code.ts +3 -0
  102. package/src/components/editor/database/schemas.ts +9 -0
  103. package/src/components/editor/renderers/cell-array.tsx +2 -1
  104. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +12 -0
  105. package/src/components/pages/gallery-page.tsx +37 -6
  106. package/src/core/MarimoApp.tsx +12 -8
  107. package/src/core/ai/context/providers/file.ts +1 -1
  108. package/src/core/cells/__tests__/cells.test.ts +120 -0
  109. package/src/core/cells/__tests__/session.test.ts +37 -1
  110. package/src/core/cells/cells.ts +14 -0
  111. package/src/core/cells/session.ts +20 -8
  112. package/src/core/codemirror/language/languages/markdown.ts +7 -0
  113. package/src/core/config/feature-flag.tsx +0 -4
  114. package/src/core/dom/uiregistry.ts +4 -1
  115. package/src/core/islands/__tests__/bridge.test.ts +7 -2
  116. package/src/core/islands/bridge.ts +1 -1
  117. package/src/core/islands/main.ts +7 -0
  118. package/src/core/network/types.ts +2 -2
  119. package/src/core/run-app.tsx +11 -4
  120. package/src/core/static/__tests__/files.test.ts +195 -1
  121. package/src/core/static/files.ts +39 -9
  122. package/src/core/wasm/bridge.ts +1 -1
  123. package/src/core/websocket/useMarimoKernelConnection.tsx +5 -15
  124. package/src/plugins/core/registerReactComponent.tsx +9 -1
  125. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +164 -0
  126. package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +93 -168
  127. package/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx +37 -123
  128. package/src/plugins/impl/anywidget/__tests__/model.test.ts +128 -122
  129. package/src/{utils/__tests__/data-views.test.ts → plugins/impl/anywidget/__tests__/serialization.test.ts} +42 -96
  130. package/src/plugins/impl/anywidget/model.ts +348 -223
  131. package/src/plugins/impl/anywidget/schemas.ts +32 -0
  132. package/src/{utils/data-views.ts → plugins/impl/anywidget/serialization.ts} +13 -36
  133. package/src/plugins/impl/anywidget/types.ts +27 -0
  134. package/src/plugins/impl/chat/chat-ui.tsx +22 -20
  135. package/src/utils/Deferred.ts +21 -0
  136. package/src/utils/__tests__/blob.test.ts +3 -3
  137. package/src/utils/__tests__/id-tree.test.ts +22 -7
  138. package/src/utils/__tests__/mime-types.test.ts +8 -10
  139. package/src/utils/__tests__/url-parser.test.ts +22 -0
  140. package/src/utils/blob.ts +14 -27
  141. package/src/utils/id-tree.tsx +11 -19
  142. package/src/utils/json/base64.ts +38 -8
  143. package/src/utils/mime-types.ts +5 -5
  144. package/src/utils/url-parser.ts +1 -1
  145. package/dist/assets/__vite-browser-external-DRa9CT_O.js +0 -1
  146. package/dist/assets/worker-SqntmiwV.js +0 -73
  147. package/dist/mermaid-4DMBBIKO-o3xNphpD.js +0 -6
@@ -1,12 +1,8 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import { describe, expect, it } from "vitest";
3
- import {
4
- decodeFromWire,
5
- isWireFormat,
6
- serializeBuffersToBase64,
7
- type WireFormat,
8
- } from "../data-views";
9
- import type { Base64String } from "../json/base64";
3
+ import type { WireFormat } from "@/plugins/impl/anywidget/types";
4
+ import type { Base64String } from "../../../../utils/json/base64";
5
+ import { decodeFromWire, serializeBuffersToBase64 } from "../serialization";
10
6
 
11
7
  describe("decodeFromWire with DataViews", () => {
12
8
  it("should return the original state if bufferPaths.length === 0", () => {
@@ -108,7 +104,7 @@ describe("Immutability Tests", () => {
108
104
  expect(input.array).toBe(input.array); // Array reference unchanged
109
105
  });
110
106
 
111
- it("decodeFromWire (wire format) should not mutate input", () => {
107
+ it("decodeFromWire (wire format) should decode base64 to DataView", () => {
112
108
  const encoder = new TextEncoder();
113
109
  const data = encoder.encode("Hello");
114
110
  const base64 = btoa(String.fromCharCode(...data)) as Base64String;
@@ -119,19 +115,16 @@ describe("Immutability Tests", () => {
119
115
  buffers: [base64],
120
116
  };
121
117
 
122
- const clone = structuredClone(input);
123
-
124
- decodeFromWire(input);
125
-
126
- // Check deep equality
127
- expect(input).toEqual(clone);
118
+ const result = decodeFromWire(input);
128
119
 
129
- // Check references are unchanged
130
- expect(input.state).toBe(input.state);
131
- expect(input.state.nested).toBe(input.state.nested);
120
+ // Result should have DataView instead of base64 string
121
+ expect(result.text).toBeInstanceOf(DataView);
122
+ // Other properties should be preserved
123
+ expect(result.number).toBe(42);
124
+ expect(result.nested).toEqual({ value: "test" });
132
125
  });
133
126
 
134
- it("decodeFromWire (with DataViews) should not mutate input", () => {
127
+ it("decodeFromWire (with DataViews) should insert buffers at paths", () => {
135
128
  const encoder = new TextEncoder();
136
129
  const dataView = new DataView(encoder.encode("data").buffer);
137
130
 
@@ -143,21 +136,21 @@ describe("Immutability Tests", () => {
143
136
  const bufferPaths = [["data"]];
144
137
  const buffers = [dataView];
145
138
 
146
- const input = { state, bufferPaths, buffers };
147
- const clone = structuredClone(input);
148
-
149
- decodeFromWire(input);
150
-
151
- // Check deep equality
152
- expect(input).toEqual(clone);
153
-
154
- // Check references are unchanged
155
- expect(input.state.nested).toBe(state.nested);
156
- expect(input.state.array).toBe(state.array);
157
- expect(input.buffers?.[0]).toBe(dataView); // Buffer reference unchanged
139
+ const result = decodeFromWire({
140
+ state,
141
+ bufferPaths,
142
+ buffers,
143
+ }) as typeof state & { data: DataView };
144
+
145
+ // Result should have the DataView at the path
146
+ expect(result.data).toBe(dataView);
147
+ // Other properties should be preserved
148
+ expect(result.placeholder).toBe("value");
149
+ expect(result.nested).toEqual({ key: "test" });
150
+ expect(result.array).toEqual([1, 2, 3]);
158
151
  });
159
152
 
160
- it("decodeFromWire should return new object, not mutate", () => {
153
+ it("decodeFromWire should insert buffers and return state", () => {
161
154
  const encoder = new TextEncoder();
162
155
  const dataView = new DataView(encoder.encode("data").buffer);
163
156
 
@@ -165,16 +158,15 @@ describe("Immutability Tests", () => {
165
158
  const bufferPaths = [["c"]];
166
159
  const buffers = [dataView];
167
160
 
168
- const result = decodeFromWire({ state, bufferPaths, buffers });
169
-
170
- // Result should be different reference
171
- expect(result).not.toBe(state);
172
-
173
- // Input should not have new property
174
- expect("c" in state).toBe(false);
161
+ const result = decodeFromWire({
162
+ state,
163
+ bufferPaths,
164
+ buffers,
165
+ }) as typeof state & { c: DataView };
175
166
 
176
167
  // Result should have new property
177
168
  expect("c" in result).toBe(true);
169
+ expect(result.c).toBe(dataView);
178
170
  });
179
171
 
180
172
  it("serializeBuffersToBase64 should return new state object", () => {
@@ -198,7 +190,7 @@ describe("Immutability Tests", () => {
198
190
  expect(typeof result.state.buffer).toBe("string");
199
191
  });
200
192
 
201
- it("decodeFromWire with object input should not mutate state", () => {
193
+ it("decodeFromWire with object input should insert buffers", () => {
202
194
  const encoder = new TextEncoder();
203
195
  const dataView = new DataView(encoder.encode("data").buffer);
204
196
 
@@ -206,16 +198,17 @@ describe("Immutability Tests", () => {
206
198
  const bufferPaths = [["d"]];
207
199
  const buffers = [dataView];
208
200
 
209
- const input = { state, bufferPaths, buffers };
210
- const clone = structuredClone(input);
211
-
212
- decodeFromWire(input);
213
-
214
- // Check deep equality
215
- expect(input).toEqual(clone);
216
-
217
- // Check references are unchanged
218
- expect(input.state.b).toBe(state.b);
201
+ const result = decodeFromWire({
202
+ state,
203
+ bufferPaths,
204
+ buffers,
205
+ }) as typeof state & { d: DataView };
206
+
207
+ // Result should have the buffer inserted
208
+ expect(result.d).toBe(dataView);
209
+ // Original properties should be preserved
210
+ expect(result.a).toBe(1);
211
+ expect(result.b).toEqual({ c: 2 });
219
212
  });
220
213
 
221
214
  it("nested objects should maintain independence after serialization", () => {
@@ -342,53 +335,6 @@ describe("serializeBuffersToBase64", () => {
342
335
  });
343
336
  });
344
337
 
345
- describe("isWireFormat", () => {
346
- it("should return true for valid wire format", () => {
347
- const wireFormat: WireFormat = {
348
- state: { a: 1 },
349
- bufferPaths: [],
350
- buffers: [],
351
- };
352
- expect(isWireFormat(wireFormat)).toBe(true);
353
- });
354
-
355
- it("should return true for wire format with data", () => {
356
- const wireFormat: WireFormat = {
357
- state: { value: "SGVsbG8=" },
358
- bufferPaths: [["value"]],
359
- buffers: ["SGVsbG8=" as Base64String],
360
- };
361
- expect(isWireFormat(wireFormat)).toBe(true);
362
- });
363
-
364
- it("should return false for null", () => {
365
- expect(isWireFormat(null)).toBe(false);
366
- });
367
-
368
- it("should return false for non-objects", () => {
369
- expect(isWireFormat("string")).toBe(false);
370
- expect(isWireFormat(123)).toBe(false);
371
- expect(isWireFormat(true)).toBe(false);
372
- expect(isWireFormat(undefined)).toBe(false);
373
- });
374
-
375
- it("should return false when missing state", () => {
376
- expect(isWireFormat({ bufferPaths: [], buffers: [] })).toBe(false);
377
- });
378
-
379
- it("should return false when missing bufferPaths", () => {
380
- expect(isWireFormat({ state: {}, buffers: [] })).toBe(false);
381
- });
382
-
383
- it("should return false when missing buffers", () => {
384
- expect(isWireFormat({ state: {}, bufferPaths: [] })).toBe(false);
385
- });
386
-
387
- it("should return false for plain objects", () => {
388
- expect(isWireFormat({ a: 1, b: 2 })).toBe(false);
389
- });
390
- });
391
-
392
338
  describe("decodeFromWire from WireFormat", () => {
393
339
  it("should return state unchanged when no buffer paths", () => {
394
340
  const wire: WireFormat = {