@marimo-team/islands 0.25.2-dev105 → 0.25.2-dev107

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 (83) hide show
  1. package/dist/{ConnectedDataExplorerComponent-CLsD_u_F.js → ConnectedDataExplorerComponent-CNSxdKyJ.js} +11 -11
  2. package/dist/{ErrorBoundary-efyVj7rF.js → ErrorBoundary-KRp3Mdlb.js} +8 -8
  3. package/dist/{abnfDiagram-VCTEODGH-DP-j9K77.js → abnfDiagram-VCTEODGH-DQDjNXt3.js} +2 -2
  4. package/dist/{any-language-editor-D5auDtxd.js → any-language-editor-B9REGlD9.js} +3 -3
  5. package/dist/{architectureDiagram-5GKGNRK7-BeQUyxB8.js → architectureDiagram-5GKGNRK7-Nmls7Wxn.js} +1 -1
  6. package/dist/{button-e0G6suEi.js → button-CvjkwdSk.js} +1 -1
  7. package/dist/{capabilities-to826YB8.js → capabilities-CQ5IjhzL.js} +1 -1
  8. package/dist/{cells-Cuf0K7MO.js → cells-CnomFgoS.js} +2958 -2938
  9. package/dist/{chat-ui-C0-ojNzY.js → chat-ui-DIoRDU4g.js} +15 -15
  10. package/dist/{check-DLTnw68H.js → check-EDwSwP89.js} +1 -1
  11. package/dist/{chunk-IMKFNOWR-Dk2PgCm2.js → chunk-IMKFNOWR-CoIFEo-1.js} +1 -1
  12. package/dist/{chunk-SHT3W25Y-BGY-9vHH.js → chunk-SHT3W25Y-lHiGx3ZC.js} +1 -1
  13. package/dist/{chunk-SVP7TREG-teKkW9Fg.js → chunk-SVP7TREG-BvsHIrY_.js} +1 -1
  14. package/dist/{chunk-TICWLB2K-DtXuhbug.js → chunk-TICWLB2K-BC8YIm_n.js} +1 -1
  15. package/dist/{classDiagram-ZZMXUADV-DbUMcd7_.js → classDiagram-ZZMXUADV-Bt98lkkv.js} +2 -2
  16. package/dist/{classDiagram-v2-VYDZK3BY-C-3L4d5M.js → classDiagram-v2-VYDZK3BY-D9bfbcC3.js} +2 -2
  17. package/dist/{code-visibility-DE54Pz9F.js → code-visibility-Czkyfmjy.js} +6 -6
  18. package/dist/{common-CTtBH0wF.js → common-Dot4N_jK.js} +22 -22
  19. package/dist/{copy-icon-BCF4LtXi.js → copy-icon-Ft7t9bqz.js} +3 -3
  20. package/dist/{cynefinDiagram-5FMLGOSQ--q32vtYo.js → cynefinDiagram-5FMLGOSQ-CgWra7wt.js} +1 -1
  21. package/dist/{dagre-GXQ25YYZ-ClJucAkw.js → dagre-GXQ25YYZ-CFZ8-35c.js} +1 -1
  22. package/dist/{data-grid-overlay-editor-DFqPk6q5.js → data-grid-overlay-editor-CeWphgdz.js} +1 -1
  23. package/dist/{diagram-S7CK7UJ4-Cyssb9Ln.js → diagram-S7CK7UJ4-lCNQrW7d.js} +1 -1
  24. package/dist/{diagram-UQ7AKVKN-DZYSgUI7.js → diagram-UQ7AKVKN-CQPQ6pP_.js} +1 -1
  25. package/dist/{diagram-VX7I27RA-CGG722Ev.js → diagram-VX7I27RA-Cf3b0llz.js} +1 -1
  26. package/dist/{diagram-Z3DM3KII-BvQr3_De.js → diagram-Z3DM3KII-Bt4QLrpn.js} +1 -1
  27. package/dist/{dialog-CmJuVSh2.js → dialog-CEBFZNyc.js} +3 -3
  28. package/dist/{dropdown-menu-DLNl0uXY.js → dropdown-menu-CP_qCYHC.js} +7 -7
  29. package/dist/{ebnfDiagram-PWID7BFC-DR2FshJT.js → ebnfDiagram-PWID7BFC-D3NAyPFY.js} +2 -2
  30. package/dist/{erDiagram-RLTQ6QDP-xnBvU5f7.js → erDiagram-RLTQ6QDP-Tlu09_Nm.js} +1 -1
  31. package/dist/{error-banner-CSBLWQOS.js → error-banner-Da600cwz.js} +2 -2
  32. package/dist/{error-entries-C7yBRMAV.js → error-entries-uqmpke4z.js} +2 -2
  33. package/dist/{feedback-button-Bp9eebz4.js → feedback-button-4_AuZCdh.js} +10 -10
  34. package/dist/{flowDiagram-HODETNUW-Bfnw9tSj.js → flowDiagram-HODETNUW-CAYbpJmV.js} +2 -2
  35. package/dist/{formats-CJxJy0A5.js → formats-DLtvJPnj.js} +3 -3
  36. package/dist/{glide-data-editor-B3gyOR9J.js → glide-data-editor-DfjSoz7Q.js} +11 -11
  37. package/dist/{glide-utils-BNg2jWFu.js → glide-utils-DJyqh0EM.js} +3 -3
  38. package/dist/{globals-D-vVdFQv.js → globals-1QqNuGFw.js} +3 -3
  39. package/dist/{html-to-image-DJECYxR4.js → html-to-image-utL-jAuh.js} +11 -11
  40. package/dist/{infoDiagram-27XIBGKW-BAYcNcaV.js → infoDiagram-27XIBGKW-XrDxhr0x.js} +1 -1
  41. package/dist/{ishikawaDiagram-5VMMS53U-DXStWIha.js → ishikawaDiagram-5VMMS53U-CD1muzov.js} +1 -1
  42. package/dist/{kanban-definition-UXKFOSKX-DbdJswTE.js → kanban-definition-UXKFOSKX-Dg9W142_.js} +1 -1
  43. package/dist/{label-csksCK90.js → label-BDKF3Afc.js} +2 -2
  44. package/dist/{loader-BBZo0c48.js → loader-BQOfjTIJ.js} +1 -1
  45. package/dist/main.js +32 -32
  46. package/dist/{mermaid-C2NJdX2u.js → mermaid-CiAXjLpA.js} +36 -36
  47. package/dist/{mindmap-definition-YA3MSWOX-BQ8i-blD.js → mindmap-definition-YA3MSWOX-DgCidgYJ.js} +1 -1
  48. package/dist/{number-overlay-editor-D20HUk2N.js → number-overlay-editor-C02SrcZc.js} +1 -1
  49. package/dist/{pegDiagram-XKGWAZYB-DUcNNAN-.js → pegDiagram-XKGWAZYB-coOYYKB6.js} +2 -2
  50. package/dist/{pieDiagram-E7YTZNPT-CSFNZSft.js → pieDiagram-E7YTZNPT-BnXTc3bj.js} +1 -1
  51. package/dist/{process-output-Donyae-q.js → process-output-tkY7JSAu.js} +4 -4
  52. package/dist/{railroadDiagram-O6MQD6OU-DIKoeErt.js → railroadDiagram-O6MQD6OU-B28-u83n.js} +2 -2
  53. package/dist/{requirementDiagram-BXWQKSXE-DbJ4dnDA.js → requirementDiagram-BXWQKSXE-CdYCTMu0.js} +1 -1
  54. package/dist/{reveal-component-4KH8dyFk.js → reveal-component-BwWtao-Q.js} +10 -10
  55. package/dist/{select-eLd7a6qs.js → select-BButFi-d.js} +4 -4
  56. package/dist/{sequenceDiagram-WJ2MYXX4-DrFl3KeD.js → sequenceDiagram-WJ2MYXX4-CM3aRAe_.js} +1 -1
  57. package/dist/{spec-DkOU7lfi.js → spec-BwarBpUJ.js} +4 -4
  58. package/dist/{stateDiagram-D77RDMKH-CW5dERQ1.js → stateDiagram-D77RDMKH-DOZUMVj8.js} +2 -2
  59. package/dist/{stateDiagram-v2-MP3YSRHH-B1BR_34Z.js → stateDiagram-v2-MP3YSRHH-CISYxma6.js} +2 -2
  60. package/dist/{swimlanes-42K2YHIH-CXasdezK.js → swimlanes-42K2YHIH-BkSppxp8.js} +1 -1
  61. package/dist/{swimlanesDiagram-VR7AAH4N-WuS8E4Md.js → swimlanesDiagram-VR7AAH4N-c8G5pGxC.js} +2 -2
  62. package/dist/{swiper-component-Bzo0y0WO.js → swiper-component-DKntyn8p.js} +2 -2
  63. package/dist/{timeline-definition-24CTP7MA-MS0jeNYt.js → timeline-definition-24CTP7MA-CaMQayqK.js} +1 -1
  64. package/dist/{toDate-CaG7azFp.js → toDate-Dwcg_x_5.js} +3 -3
  65. package/dist/{toast-DEQUzOQE.js → toast-B9UMEi8u.js} +4 -4
  66. package/dist/{tooltip-Dbmm909v.js → tooltip-BO1REbqs.js} +2 -2
  67. package/dist/{use-restore-focus-B7_UeKnI.js → use-restore-focus-BEM7sFWl.js} +1 -1
  68. package/dist/{useAsyncData-B2hCigr0.js → useAsyncData-Deh5kszT.js} +1 -1
  69. package/dist/{useDateFormatter-DtgICMM1.js → useDateFormatter-D8XruNGG.js} +2 -2
  70. package/dist/{useDeepCompareMemoize-NxOUy83E.js → useDeepCompareMemoize-DXwzRINI.js} +1 -1
  71. package/dist/{useIframeCapabilities-DIRs8689.js → useIframeCapabilities-DBETvvPl.js} +1 -1
  72. package/dist/{useLifecycle-NfWtOhUr.js → useLifecycle-j7D9uD1o.js} +3 -3
  73. package/dist/{useTheme-DdoJP40B.js → useTheme-CRnjkku0.js} +2 -2
  74. package/dist/{vega-component-lajX4E5T.js → vega-component-DLBAQLSf.js} +9 -9
  75. package/dist/{vennDiagram-4TSXK5OY-BjY3_fWF.js → vennDiagram-4TSXK5OY-CF8pfaK3.js} +1 -1
  76. package/dist/{wardleyDiagram-VM6X3IG4-CmNH2_Vg.js → wardleyDiagram-VM6X3IG4-dGPu39d-.js} +1 -1
  77. package/dist/{xychartDiagram-S5SC5T6Z-frIXgxSb.js → xychartDiagram-S5SC5T6Z-CP6-9q56.js} +1 -1
  78. package/package.json +1 -1
  79. package/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts +138 -26
  80. package/src/core/codemirror/language/embedded/embedded-python.ts +47 -13
  81. package/src/core/codemirror/language/embedded/latex.ts +20 -13
  82. package/src/hooks/__tests__/useEventListener.test.tsx +45 -1
  83. package/src/hooks/useEventListener.ts +6 -1
@@ -29,7 +29,7 @@
29
29
  // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
30
  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
31
 
32
- import { type Parser, parseMixed } from "@lezer/common";
32
+ import { IterMode, type Parser, parseMixed } from "@lezer/common";
33
33
  import { tags } from "@lezer/highlight";
34
34
  import type {
35
35
  DelimiterType,
@@ -231,24 +231,31 @@ export function parseLatex(latexParser: Parser): MarkdownConfig {
231
231
  // Test if the node type is one of the math expression
232
232
  const delimiterLength = DELIMITER_LENGTH[node.type.name];
233
233
  if (delimiterLength) {
234
- const from = node.from + delimiterLength;
235
- const to = node.to - delimiterLength;
234
+ const from = node.node.firstChild?.to ?? node.from + delimiterLength;
235
+ const to = node.node.lastChild?.from ?? node.to - delimiterLength;
236
236
 
237
237
  // Ensure valid ranges
238
238
  if (from >= to || from < 0 || to < 0) {
239
239
  return null;
240
240
  }
241
241
 
242
- return {
243
- parser: latexParser,
244
- // Remove delimiter from LaTeX parser otherwise it won't be highlighted
245
- overlay: [
246
- {
247
- from,
248
- to,
249
- },
250
- ],
251
- };
242
+ // Leave Python replacements to their own parser and highlighter.
243
+ const overlay: { from: number; to: number }[] = [];
244
+ let start = from;
245
+ node.node.cursor(IterMode.IgnoreMounts).iterate((child) => {
246
+ if (child.name !== "Python") {
247
+ return;
248
+ }
249
+ if (start < child.from) {
250
+ overlay.push({ from: start, to: child.from });
251
+ }
252
+ start = child.to;
253
+ return false;
254
+ });
255
+ if (start < to) {
256
+ overlay.push({ from: start, to });
257
+ }
258
+ return overlay.length ? { parser: latexParser, overlay } : null;
252
259
  }
253
260
 
254
261
  return null;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { renderHook } from "@testing-library/react";
4
4
  import { useRef } from "react";
5
- import { beforeEach, describe, expect, it, vi } from "vitest";
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
6
6
  import {
7
7
  type HTMLElementNotDerivedFromRef,
8
8
  isRefObject,
@@ -28,6 +28,50 @@ describe("isRefObject", () => {
28
28
  });
29
29
  });
30
30
 
31
+ describe.each([1, 2])("with %i anchors named current", (count) => {
32
+ let iframe: HTMLIFrameElement;
33
+ let browserWindow: Window;
34
+
35
+ beforeEach(() => {
36
+ // An iframe preserves named properties hidden by Vitest's global window.
37
+ iframe = document.createElement("iframe");
38
+ document.body.append(iframe);
39
+ if (!iframe.contentWindow) {
40
+ throw new Error("Expected an iframe window");
41
+ }
42
+ browserWindow = iframe.contentWindow;
43
+ const anchors = Array.from({ length: count }, () => {
44
+ const anchor = browserWindow.document.createElement("a");
45
+ anchor.id = "current";
46
+ return anchor;
47
+ });
48
+ browserWindow.document.body.append(...anchors);
49
+ });
50
+
51
+ afterEach(() => {
52
+ iframe.remove();
53
+ });
54
+
55
+ it("does not mistake window for a React ref", () => {
56
+ expect("current" in browserWindow).toBe(true);
57
+ expect(isRefObject(browserWindow)).toBe(false);
58
+ });
59
+
60
+ it("attaches and removes the listener on window", () => {
61
+ const listener = vi.fn();
62
+ const { unmount } = renderHook(() =>
63
+ useEventListener(browserWindow, "resize", listener),
64
+ );
65
+
66
+ browserWindow.dispatchEvent(new Event("resize"));
67
+ expect(listener).toHaveBeenCalledTimes(1);
68
+
69
+ unmount();
70
+ browserWindow.dispatchEvent(new Event("resize"));
71
+ expect(listener).toHaveBeenCalledTimes(1);
72
+ });
73
+ });
74
+
31
75
  describe("useEventListener", () => {
32
76
  beforeEach(() => {
33
77
  vi.clearAllMocks();
@@ -13,7 +13,12 @@ export type HTMLElementNotDerivedFromRef<T = HTMLElement> = T & {
13
13
  };
14
14
 
15
15
  export function isRefObject<T>(target: unknown): target is RefObject<T | null> {
16
- return target !== null && typeof target === "object" && "current" in target;
16
+ return (
17
+ target !== null &&
18
+ typeof target === "object" &&
19
+ !("addEventListener" in target) &&
20
+ "current" in target
21
+ );
17
22
  }
18
23
 
19
24
  export function useEventListener<K extends keyof DocumentEventMap>(