@marimo-team/islands 0.26.1-dev104 → 0.26.1-dev108

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 (106) hide show
  1. package/dist/{ConnectedDataExplorerComponent-BJBdnd0O.js → ConnectedDataExplorerComponent-DQaiOY7w.js} +15 -15
  2. package/dist/{ErrorBoundary-DLR6xE2E.js → ErrorBoundary-BW4TciqU.js} +19 -19
  3. package/dist/{abnfDiagram-VCTEODGH-Ba0MYVW8.js → abnfDiagram-VCTEODGH-Df80tEYq.js} +2 -2
  4. package/dist/{any-language-editor-BNe8do3C.js → any-language-editor-BW-gNmbk.js} +2 -2
  5. package/dist/{architectureDiagram-5GKGNRK7-7MqAehef.js → architectureDiagram-5GKGNRK7-DNNMvKkY.js} +1 -1
  6. package/dist/{assertNever-5vhHGKOK.js → assertNever-B9_7z-dW.js} +13 -13
  7. package/dist/{chat-ui-Bs3rgm2m.js → chat-ui-Be9X-W22.js} +49 -49
  8. package/dist/{check-DUIc04aK.js → check-BqF09bSG.js} +1 -1
  9. package/dist/{chunk-IMKFNOWR-CAWA0HGB.js → chunk-IMKFNOWR-pXqnQ_fj.js} +1 -1
  10. package/dist/{chunk-SHT3W25Y-BIwVQjG5.js → chunk-SHT3W25Y-BWrxB3I2.js} +1 -1
  11. package/dist/{chunk-SVP7TREG-Cux251TB.js → chunk-SVP7TREG-CPdQP8_U.js} +1 -1
  12. package/dist/{chunk-TICWLB2K-DJVQ6khO.js → chunk-TICWLB2K-C5MYCwBz.js} +1 -1
  13. package/dist/{circle-question-mark-evCnVIut.js → circle-question-mark-YmLYXyvS.js} +1 -1
  14. package/dist/{classDiagram-ZZMXUADV-Cwve77ev.js → classDiagram-ZZMXUADV-Ba0SRm01.js} +2 -2
  15. package/dist/{classDiagram-v2-VYDZK3BY-BAeHKXmD.js → classDiagram-v2-VYDZK3BY-DSSzL_Dk.js} +2 -2
  16. package/dist/{code-visibility-BhWW3jkv.js → code-visibility-BKmktPMd.js} +18 -18
  17. package/dist/{common-i4mVHMGl.js → common-CSJAjJGa.js} +169 -169
  18. package/dist/{copy-icon-CmNLxT5_.js → copy-icon-zP4__HPI.js} +2 -2
  19. package/dist/{createReducer-BUQhgLOI.js → createReducer-CArOwUaJ.js} +16 -19
  20. package/dist/{cynefinDiagram-5FMLGOSQ-t4eEkPJh.js → cynefinDiagram-5FMLGOSQ-BOtNvA04.js} +1 -1
  21. package/dist/{dagre-GXQ25YYZ-IuZuI28B.js → dagre-GXQ25YYZ-FpCEOTxX.js} +1 -1
  22. package/dist/{data-grid-overlay-editor-7durYJXa.js → data-grid-overlay-editor-DTibdR4H.js} +1 -1
  23. package/dist/{diagram-S7CK7UJ4-D8R5Q_ok.js → diagram-S7CK7UJ4-Cm1HaBuu.js} +1 -1
  24. package/dist/{diagram-UQ7AKVKN-BGuMPsr-.js → diagram-UQ7AKVKN-D1lA7Ggu.js} +1 -1
  25. package/dist/{diagram-VX7I27RA-BkTtpO8P.js → diagram-VX7I27RA-BX3e-Rue.js} +1 -1
  26. package/dist/{diagram-Z3DM3KII-C0__Mxfm.js → diagram-Z3DM3KII-Dgoj7bPf.js} +1 -1
  27. package/dist/{dialog-BvjfalZ9.js → dialog-DfKgafXJ.js} +30 -30
  28. package/dist/{dropdown-menu-D0DeN-aL.js → dropdown-menu-Dge_SmqE.js} +168 -168
  29. package/dist/{ebnfDiagram-PWID7BFC-CSESPZoz.js → ebnfDiagram-PWID7BFC-B0xWiXrz.js} +2 -2
  30. package/dist/{erDiagram-RLTQ6QDP-DsDTtabH.js → erDiagram-RLTQ6QDP-Cm-GO31-.js} +1 -1
  31. package/dist/{error-banner-CXLjTW24.js → error-banner-CfYrJaIb.js} +91 -91
  32. package/dist/{error-entries-BcAyFIeh.js → error-entries-23Z_1oDM.js} +586 -595
  33. package/dist/{export-context-CkgZeARR.js → export-context-B1jdxzHF.js} +21 -21
  34. package/dist/{feedback-button-CeuzSBrq.js → feedback-button-CPu5SV3b.js} +72 -72
  35. package/dist/{flowDiagram-HODETNUW-qxDPYbfV.js → flowDiagram-HODETNUW-CH6xMlW_.js} +2 -2
  36. package/dist/{formats-CcQrzFo8.js → formats-Y52bg800.js} +1 -1
  37. package/dist/{glide-data-editor-BLGr2vQF.js → glide-data-editor-CC9_NDNi.js} +11 -11
  38. package/dist/{glide-utils-CD8BaFTm.js → glide-utils-BRcuSTCx.js} +2 -2
  39. package/dist/{globals-DorvG5dC.js → globals-BFlYTNoR.js} +3 -3
  40. package/dist/{html-to-image-BmLTjaGw.js → html-to-image-Cw7o1IbE.js} +4300 -4296
  41. package/dist/{infoDiagram-27XIBGKW-B5hq8RM_.js → infoDiagram-27XIBGKW-DbUO63CX.js} +1 -1
  42. package/dist/{ishikawaDiagram-5VMMS53U-DkHc_9ET.js → ishikawaDiagram-5VMMS53U-CfQrrELH.js} +1 -1
  43. package/dist/{kanban-definition-UXKFOSKX-CqkTFXmU.js → kanban-definition-UXKFOSKX-C5SJcu1W.js} +1 -1
  44. package/dist/{loader-CGrYn73j.js → loader-C9-qRO3m.js} +2 -2
  45. package/dist/main.js +6698 -6604
  46. package/dist/{mermaid-pmVHDUQA.js → mermaid-C2alqcd8.js} +34 -34
  47. package/dist/{mindmap-definition-YA3MSWOX-D6cNa__z.js → mindmap-definition-YA3MSWOX-ByVHE0Ax.js} +1 -1
  48. package/dist/{number-overlay-editor-DQAdvZrn.js → number-overlay-editor-qDcRKPE0.js} +1 -1
  49. package/dist/{pegDiagram-XKGWAZYB-CmWJX_s1.js → pegDiagram-XKGWAZYB-DF5FBKZi.js} +2 -2
  50. package/dist/{pencil-CxMgOe04.js → pencil-D7jyZPnP.js} +1 -1
  51. package/dist/{pieDiagram-E7YTZNPT-CAQAxHah.js → pieDiagram-E7YTZNPT-B5n9nBQN.js} +1 -1
  52. package/dist/{process-output-CcNpl5Qu.js → process-output-DdBM0lmd.js} +4 -4
  53. package/dist/{railroadDiagram-O6MQD6OU-jlSsiQg3.js → railroadDiagram-O6MQD6OU-r5t7OYNE.js} +2 -2
  54. package/dist/{requirementDiagram-BXWQKSXE-DkDjfPhn.js → requirementDiagram-BXWQKSXE-D4QtEyZQ.js} +1 -1
  55. package/dist/{reveal-component-B6xeeht1.js → reveal-component-BE1xhtNc.js} +1008 -1008
  56. package/dist/{select-CEnB18uc.js → select-Buk3aXi1.js} +341 -341
  57. package/dist/{sequenceDiagram-WJ2MYXX4-DLywsGCW.js → sequenceDiagram-WJ2MYXX4-CK3Atn-z.js} +1 -1
  58. package/dist/{spec-Dz-Avv1m.js → spec-BEp9O9dy.js} +4 -4
  59. package/dist/{stateDiagram-D77RDMKH-DUmlKwYU.js → stateDiagram-D77RDMKH-C1SxRI8V.js} +2 -2
  60. package/dist/{stateDiagram-v2-MP3YSRHH-D646KiXs.js → stateDiagram-v2-MP3YSRHH-DK5X6bsr.js} +2 -2
  61. package/dist/{static-state-iw0PrHK4.js → static-state-D-aT9dOr.js} +9 -9
  62. package/dist/{swimlanes-42K2YHIH-L7B1GphF.js → swimlanes-42K2YHIH-DdH5TZdu.js} +1 -1
  63. package/dist/{swimlanesDiagram-VR7AAH4N-DEu2wxtC.js → swimlanesDiagram-VR7AAH4N-CWBIvzgR.js} +2 -2
  64. package/dist/{timeline-definition-24CTP7MA-DDPyx1yG.js → timeline-definition-24CTP7MA-DE7-o2zU.js} +1 -1
  65. package/dist/{toast-BTjH6fIf.js → toast-b3k4YxaT.js} +54 -54
  66. package/dist/{tooltip-DyLdBIM4.js → tooltip-D-9pDheN.js} +62 -62
  67. package/dist/{use-restore-focus-DJ_-uSn_.js → use-restore-focus-CCfk-ey2.js} +1 -1
  68. package/dist/{useDateFormatter-HpKD0jEC.js → useDateFormatter-DH0uFwfL.js} +2 -2
  69. package/dist/{useDeepCompareMemoize-CHx-NxMl.js → useDeepCompareMemoize-Dn-ZJVTd.js} +1 -1
  70. package/dist/{useLifecycle-tPpAt-OE.js → useLifecycle-yjK7JsRL.js} +1 -1
  71. package/dist/{vega-component-BzNDFvQf.js → vega-component-BIq0qzhQ.js} +8 -8
  72. package/dist/{vennDiagram-4TSXK5OY-CRwWeb7g.js → vennDiagram-4TSXK5OY-D7yfNz0d.js} +1 -1
  73. package/dist/{wardleyDiagram-VM6X3IG4-DVlG9eoq.js → wardleyDiagram-VM6X3IG4-m5Jcz26Z.js} +1 -1
  74. package/dist/{xychartDiagram-S5SC5T6Z-CM32AISp.js → xychartDiagram-S5SC5T6Z-CA3zV3RW.js} +1 -1
  75. package/package.json +1 -1
  76. package/src/__mocks__/intersection-observer.ts +13 -12
  77. package/src/components/editor/Output.tsx +1 -1
  78. package/src/components/editor/__tests__/cell-renders.test.tsx +17 -1
  79. package/src/components/editor/cell/__tests__/cell-actions.test.tsx +74 -0
  80. package/src/components/editor/cell/cell-action-body.tsx +28 -0
  81. package/src/components/editor/cell/cell-actions.tsx +60 -72
  82. package/src/components/editor/cell/cell-context-menu.tsx +36 -62
  83. package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +517 -68
  84. package/src/components/editor/chrome/panels/outline/__tests__/useActiveOutline.test.ts +17 -5
  85. package/src/components/editor/chrome/panels/outline/floating-outline.tsx +29 -59
  86. package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +333 -133
  87. package/src/components/editor/chrome/panels/outline-panel.tsx +5 -19
  88. package/src/components/editor/navigation/navigation.ts +1 -1
  89. package/src/components/editor/notebook-cell.tsx +263 -267
  90. package/src/core/cells/__tests__/layout.test.ts +1 -1
  91. package/src/core/cells/__tests__/notebook-outline.test.ts +31 -3
  92. package/src/core/cells/__tests__/use-cell-actions.test.tsx +48 -0
  93. package/src/core/cells/actions.ts +68 -89
  94. package/src/core/cells/cells.ts +23 -14
  95. package/src/core/cells/outline.ts +8 -8
  96. package/src/core/codemirror/language/extension.ts +6 -3
  97. package/src/core/codemirror/language/panel/panel.test.tsx +144 -0
  98. package/src/core/codemirror/language/panel/panel.tsx +9 -6
  99. package/src/core/codemirror/react-dom/createPanel.tsx +15 -15
  100. package/src/core/dom/__tests__/outline.test.ts +29 -170
  101. package/src/core/dom/outline.ts +21 -61
  102. package/src/core/executions/atoms.ts +12 -4
  103. package/src/core/islands/components/output-wrapper.tsx +7 -2
  104. package/src/plugins/layout/OutlinePlugin.tsx +5 -17
  105. package/src/utils/__tests__/createReducer.test.tsx +4 -3
  106. package/src/utils/createReducer.ts +19 -12
@@ -13,10 +13,7 @@ import React, {
13
13
  } from "react";
14
14
  import useEvent from "react-use-event-hook";
15
15
  import { getCellForDomProps } from "@/components/data-table/cell-utils";
16
- import {
17
- renderMinimalShortcut,
18
- renderShortcut,
19
- } from "@/components/shortcuts/renderShortcut";
16
+ import { renderShortcut } from "@/components/shortcuts/renderShortcut";
20
17
  import {
21
18
  Command,
22
19
  CommandEmpty,
@@ -31,7 +28,6 @@ import {
31
28
  PopoverTrigger,
32
29
  } from "@/components/ui/popover";
33
30
  import {
34
- Tooltip,
35
31
  TooltipContent,
36
32
  TooltipRoot,
37
33
  TooltipTrigger,
@@ -45,6 +41,7 @@ import {
45
41
  useCellActionButtons,
46
42
  } from "../actions/useCellActionButton";
47
43
  import { raf2 } from "../navigation/focus-utils";
44
+ import { CellActionBody } from "./cell-action-body";
48
45
 
49
46
  interface Props extends CellActionButtonProps {
50
47
  children: React.ReactNode;
@@ -61,14 +58,7 @@ const CellActionsDropdownInternal = (
61
58
  ) => {
62
59
  const [open, setOpen] = useState(false);
63
60
  const pendingAction = useRef<(() => void) | null>(null);
64
- const closePopover = () => setOpen(false);
65
61
  const buttonRef = useRef<HTMLButtonElement>(null);
66
- const actions = useCellActionButtons({ cell: props, closePopover });
67
-
68
- const visibleActions = actions
69
- .map((group) => group.filter((action) => !action.redundant))
70
- .filter((group) => group.length > 0);
71
-
72
62
  // store the last focused element so we can restore it when the popover closes
73
63
  const restoreFocus = useRestoreFocus();
74
64
 
@@ -119,66 +109,13 @@ const CellActionsDropdownInternal = (
119
109
  }
120
110
  }}
121
111
  >
122
- <Command>
123
- <CommandInput
124
- placeholder="Search actions..."
125
- className="h-6 m-1"
126
- {...getCellForDomProps(props.cellId)}
127
- />
128
- <CommandList>
129
- <CommandEmpty>No results</CommandEmpty>
130
- {visibleActions.map((group, i) => (
131
- <Fragment key={i}>
132
- <CommandGroup key={i}>
133
- {group.map((action) => {
134
- let body = (
135
- <div className="flex items-center flex-1">
136
- {action.icon && (
137
- <div className="mr-2 w-5 text-muted-foreground">
138
- {action.icon}
139
- </div>
140
- )}
141
- <div className="flex-1">{action.label}</div>
142
- <div className="shrink-0 text-sm">
143
- {action.hotkey && renderMinimalShortcut(action.hotkey)}
144
- {action.rightElement}
145
- </div>
146
- </div>
147
- );
148
-
149
- if (action.tooltip) {
150
- body = (
151
- <Tooltip content={action.tooltip} delayDuration={100}>
152
- {body}
153
- </Tooltip>
154
- );
155
- }
156
-
157
- return (
158
- <CommandItem
159
- key={action.label}
160
- // Disable with classname instead of disabled prop
161
- // otherwise the tooltip doesn't work
162
- className={cn(action.disabled && "opacity-50!")}
163
- onSelect={() => {
164
- if (action.disableClick || action.disabled) {
165
- return;
166
- }
167
- pendingAction.current = action.handle;
168
- setOpen(false);
169
- }}
170
- variant={action.variant}
171
- >
172
- {body}
173
- </CommandItem>
174
- );
175
- })}
176
- </CommandGroup>
177
- {i < visibleActions.length - 1 && <CommandSeparator />}
178
- </Fragment>
179
- ))}
180
- </CommandList>
181
- </Command>
112
+ <CellActionsCommand
113
+ cell={props}
114
+ closePopover={(action) => {
115
+ pendingAction.current = action ?? null;
116
+ setOpen(false);
117
+ }}
118
+ />
182
119
  </PopoverContent>
183
120
  );
184
121
 
@@ -213,6 +150,57 @@ const CellActionsDropdownInternal = (
213
150
  );
214
151
  };
215
152
 
153
+ function CellActionsCommand({
154
+ cell,
155
+ closePopover,
156
+ }: {
157
+ cell: CellActionButtonProps;
158
+ closePopover: (action?: () => void) => void;
159
+ }) {
160
+ const actions = useCellActionButtons({ cell, closePopover });
161
+
162
+ const visibleActions = actions
163
+ .map((group) => group.filter((action) => !action.redundant))
164
+ .filter((group) => group.length > 0);
165
+
166
+ return (
167
+ <Command>
168
+ <CommandInput
169
+ placeholder="Search actions..."
170
+ className="h-6 m-1"
171
+ {...getCellForDomProps(cell.cellId)}
172
+ />
173
+ <CommandList>
174
+ <CommandEmpty>No results</CommandEmpty>
175
+ {visibleActions.map((group, i) => (
176
+ <Fragment key={i}>
177
+ <CommandGroup key={i}>
178
+ {group.map((action) => (
179
+ <CommandItem
180
+ key={action.label}
181
+ // Disable with classname instead of disabled prop
182
+ // otherwise the tooltip doesn't work
183
+ className={cn(action.disabled && "opacity-50!")}
184
+ onSelect={() => {
185
+ if (action.disableClick || action.disabled) {
186
+ return;
187
+ }
188
+ closePopover(action.handle);
189
+ }}
190
+ variant={action.variant}
191
+ >
192
+ <CellActionBody action={action} />
193
+ </CommandItem>
194
+ ))}
195
+ </CommandGroup>
196
+ {i < visibleActions.length - 1 && <CommandSeparator />}
197
+ </Fragment>
198
+ ))}
199
+ </CommandList>
200
+ </Command>
201
+ );
202
+ }
203
+
216
204
  export const CellActionsDropdown = React.memo(
217
205
  React.forwardRef(CellActionsDropdownInternal),
218
206
  );
@@ -11,7 +11,6 @@ import {
11
11
  import React, { Fragment } from "react";
12
12
  import { Slot } from "radix-ui";
13
13
  import useEvent from "react-use-event-hook";
14
- import { renderMinimalShortcut } from "@/components/shortcuts/renderShortcut";
15
14
  import {
16
15
  ContextMenu,
17
16
  ContextMenuContent,
@@ -20,7 +19,6 @@ import {
20
19
  ContextMenuTrigger,
21
20
  } from "@/components/ui/context-menu";
22
21
  import { menuItemVariants } from "@/components/ui/menu-items";
23
- import { Tooltip } from "@/components/ui/tooltip";
24
22
  import { toast } from "@/components/ui/use-toast";
25
23
  import { useRestoreFocus } from "@/components/ui/use-restore-focus";
26
24
  import { useCellData, useCellRuntime } from "@/core/cells/cells";
@@ -37,6 +35,7 @@ import {
37
35
  type CellActionButtonProps,
38
36
  useCellActionButtons,
39
37
  } from "../actions/useCellActionButton";
38
+ import { CellActionBody } from "./cell-action-body";
40
39
 
41
40
  interface Props extends Pick<
42
41
  CellActionButtonProps,
@@ -328,67 +327,42 @@ const CellMenuContent = ({
328
327
  }}
329
328
  >
330
329
  {visibleActions.flatMap((group, i) => [
331
- ...group.map((action) => {
332
- let body = (
333
- <div className="flex items-center flex-1">
334
- {action.icon && (
335
- <div className="mr-2 w-5 text-muted-foreground">
336
- {action.icon}
330
+ ...group.map((action) => (
331
+ <Fragment key={action.label}>
332
+ {
333
+ // Set disableClick items such as cell name input
334
+ // to div to prevent roving focus
335
+ action.disableClick ? (
336
+ <div
337
+ className={menuItemVariants({
338
+ className: action.disabled ? "opacity-50!" : "",
339
+ variant: action.variant,
340
+ })}
341
+ onKeyDown={(evt) => {
342
+ evt.stopPropagation();
343
+ }}
344
+ // Prevent keydown propagation, that focus does not jump to shortcut which start with same letter
345
+ // e.g. input "C", then focus jump to "Copy"
346
+ >
347
+ <CellActionBody action={action} />
337
348
  </div>
338
- )}
339
- <div className="flex-1">{action.label}</div>
340
- <div className="shrink-0 text-sm">
341
- {action.hotkey && renderMinimalShortcut(action.hotkey)}
342
- {action.rightElement}
343
- </div>
344
- </div>
345
- );
346
-
347
- if (action.tooltip) {
348
- body = (
349
- <Tooltip delayDuration={100} content={action.tooltip}>
350
- {body}
351
- </Tooltip>
352
- );
353
- }
354
-
355
- return (
356
- <Fragment key={action.label}>
357
- {
358
- // Set disableClick items such as cell name input
359
- // to div to prevent roving focus
360
- action.disableClick ? (
361
- <div
362
- className={menuItemVariants({
363
- className: action.disabled ? "opacity-50!" : "",
364
- variant: action.variant,
365
- })}
366
- onKeyDown={(evt) => {
367
- evt.stopPropagation();
368
- }}
369
- // Prevent keydown propagation, that focus does not jump to shortcut which start with same letter
370
- // e.g. input "C", then focus jump to "Copy"
371
- >
372
- {body}
373
- </div>
374
- ) : (
375
- <ContextMenuItem
376
- className={action.disabled ? "opacity-50!" : ""}
377
- onSelect={(evt) => {
378
- if (action.disableClick || action.disabled) {
379
- return;
380
- }
381
- pendingAction.current = () => action.handle(evt);
382
- }}
383
- variant={action.variant}
384
- >
385
- {body}
386
- </ContextMenuItem>
387
- )
388
- }
389
- </Fragment>
390
- );
391
- }),
349
+ ) : (
350
+ <ContextMenuItem
351
+ className={action.disabled ? "opacity-50!" : ""}
352
+ onSelect={(evt) => {
353
+ if (action.disableClick || action.disabled) {
354
+ return;
355
+ }
356
+ pendingAction.current = () => action.handle(evt);
357
+ }}
358
+ variant={action.variant}
359
+ >
360
+ <CellActionBody action={action} />
361
+ </ContextMenuItem>
362
+ )
363
+ }
364
+ </Fragment>
365
+ )),
392
366
  i < visibleActions.length - 1 && (
393
367
  <ContextMenuSeparator key={`separator-${group[0].label}`} />
394
368
  ),