@marimo-team/islands 0.24.1-dev110 → 0.24.1-dev113

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.
@@ -1,4 +1,4 @@
1
- import { O as e, nt as t, tt as n } from "./html-to-image-CR571yeU.js";
1
+ import { O as e, nt as t, tt as n } from "./html-to-image-Cf3vfRXj.js";
2
2
  import { u as r } from "./dist-CSjGX93W.js";
3
3
  import { b as i } from "./select-foAi7oM_.js";
4
4
  import { n as a } from "./semaphore-89jsoHtS.js";
@@ -2,11 +2,11 @@ import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
2
2
  import { c as t, g as n, h as r, m as i, t as a } from "./button-BeWeF5Z2.js";
3
3
  import { t as o } from "./react-DMWcHin-.js";
4
4
  import { t as s } from "./compiler-runtime-CAH9RLw2.js";
5
- import { Ot as c, ot as l } from "./html-to-image-CR571yeU.js";
5
+ import { Ot as c, ot as l } from "./html-to-image-Cf3vfRXj.js";
6
6
  import { u } from "./dist-CSjGX93W.js";
7
- import { _n as d, c as f, ct as p, g as m, h, l as g, lt as _, n as v, o as y, r as b, t as x, u as S, ut as C, vn as w, xn as T } from "./common-DTE0vt-W.js";
7
+ import { _n as d, c as f, ct as p, g as m, h, l as g, lt as _, n as v, o as y, r as b, t as x, u as S, ut as C, vn as w, xn as T } from "./common-CHiGez3b.js";
8
8
  import { R as E } from "./select-foAi7oM_.js";
9
- import { Y as D } from "./dropdown-menu-Bu3uypnP.js";
9
+ import { Y as D } from "./dropdown-menu-D-pePvPo.js";
10
10
  import { t as O } from "./jsx-runtime-CpoKNRgu.js";
11
11
  import { Tc as k } from "./schemas-CLB4UWgG.js";
12
12
  import { t as A } from "./tooltip-B1X8ECYn.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.24.1-dev110",
3
+ "version": "0.24.1-dev113",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -25,6 +25,7 @@ const FIELD_TYPES: FieldTypesWithExternalType = [
25
25
  ];
26
26
 
27
27
  type Row = Record<string, unknown>;
28
+ const EMPTY_HIDDEN_COLUMNS: readonly string[] = [];
28
29
 
29
30
  const TEST_COLUMNS: ColumnDef<Row>[] = [
30
31
  { id: "customer_name", accessorKey: "customer_name" },
@@ -34,12 +35,12 @@ const TEST_COLUMNS: ColumnDef<Row>[] = [
34
35
 
35
36
  interface HarnessProps {
36
37
  totalColumns?: number;
37
- initiallyHidden?: string[];
38
+ initiallyHidden?: readonly string[];
38
39
  }
39
40
 
40
41
  function PanelHarness({
41
42
  totalColumns = 3,
42
- initiallyHidden = [],
43
+ initiallyHidden = EMPTY_HIDDEN_COLUMNS,
43
44
  }: HarnessProps) {
44
45
  const table = useReactTable<Row>({
45
46
  data: [],
@@ -21,6 +21,7 @@ beforeAll(() => {
21
21
  });
22
22
 
23
23
  type Row = Record<string, unknown>;
24
+ const EMPTY_COLUMN_IDS: readonly string[] = [];
24
25
 
25
26
  // Select, index, and nameless columns are non-hideable in production
26
27
  // (see columns.tsx), so the harness mirrors that to keep visibility counts
@@ -47,11 +48,14 @@ const TEST_COLUMNS: ColumnDef<Row>[] = [
47
48
  ];
48
49
 
49
50
  interface HarnessProps {
50
- initiallyHidden?: string[];
51
- nonHideable?: string[];
51
+ initiallyHidden?: readonly string[];
52
+ nonHideable?: readonly string[];
52
53
  }
53
54
 
54
- function Harness({ initiallyHidden = [], nonHideable = [] }: HarnessProps) {
55
+ function Harness({
56
+ initiallyHidden = EMPTY_COLUMN_IDS,
57
+ nonHideable = EMPTY_COLUMN_IDS,
58
+ }: HarnessProps) {
55
59
  const table = useReactTable<Row>({
56
60
  data: [],
57
61
  columns: TEST_COLUMNS.map((column) =>
@@ -68,6 +68,8 @@ interface SecretComboboxProps {
68
68
  allowCreateSecret?: (search: string) => boolean;
69
69
  }
70
70
 
71
+ const defaultCustomValueLabel = (custom: string) => `Use "${custom}"`;
72
+
71
73
  /**
72
74
  * Searchable combobox for connection fields that may reference secrets.
73
75
  *
@@ -84,7 +86,7 @@ export const SecretCombobox: React.FC<SecretComboboxProps> = ({
84
86
  onCreateSecret,
85
87
  className,
86
88
  searchPlaceholder,
87
- formatCustomValueLabel = (custom) => `Use "${custom}"`,
89
+ formatCustomValueLabel = defaultCustomValueLabel,
88
90
  createSecretLabel = "Create a new secret",
89
91
  allowCustomValue,
90
92
  allowCreateSecret,
@@ -189,6 +189,8 @@ export const MediaRenderer: React.FC<MediaSource & { mimeType: string }> = ({
189
189
  * based on MIME type. Used by both the local file viewer and the
190
190
  * storage file viewer.
191
191
  */
192
+ const EMPTY_EXTENSIONS: readonly Extension[] = [];
193
+
192
194
  export const FileContentRenderer: React.FC<{
193
195
  mimeType: string;
194
196
  filename?: string;
@@ -199,7 +201,7 @@ export const FileContentRenderer: React.FC<{
199
201
  readOnly?: boolean;
200
202
  onChange?: (value: string) => void;
201
203
  /** Additional CodeMirror extensions (e.g. save hotkey). */
202
- extensions?: Extension[];
204
+ extensions?: readonly Extension[];
203
205
  }> = ({
204
206
  mimeType,
205
207
  filename,
@@ -207,7 +209,7 @@ export const FileContentRenderer: React.FC<{
207
209
  mediaSource,
208
210
  readOnly = true,
209
211
  onChange,
210
- extensions = [],
212
+ extensions = EMPTY_EXTENSIONS,
211
213
  }) => {
212
214
  const { theme } = useTheme();
213
215
 
@@ -60,15 +60,17 @@ interface Props<T extends FieldValues> {
60
60
  form: UseFormReturn<T>;
61
61
  schema: z.ZodType;
62
62
  path?: Path<T>;
63
- renderers: FormRenderer<T>[] | undefined;
63
+ renderers: readonly FormRenderer<T>[] | undefined;
64
64
  children?: React.ReactNode;
65
65
  }
66
66
 
67
+ const EMPTY_RENDERERS: readonly never[] = [];
68
+
67
69
  export const ZodForm = <T extends FieldValues>({
68
70
  schema,
69
71
  form,
70
72
  path = "" as Path<T>,
71
- renderers = [],
73
+ renderers = EMPTY_RENDERERS,
72
74
  children,
73
75
  }: Props<T>) => {
74
76
  return (
@@ -83,7 +85,7 @@ export interface RenderZodSchemaOptions<T extends FieldValues, S> {
83
85
  schema: z.ZodType<S>;
84
86
  form: UseFormReturn<T>;
85
87
  path: Path<T>;
86
- renderers: FormRenderer<T>[];
88
+ renderers: readonly FormRenderer<T>[];
87
89
  }
88
90
 
89
91
  export function renderZodSchema<T extends FieldValues, S>({
@@ -516,7 +518,7 @@ const FormArray = ({
516
518
  schema: z.ZodType;
517
519
  form: UseFormReturn<any>;
518
520
  path: Path<any>;
519
- renderers: FormRenderer[];
521
+ renderers: readonly FormRenderer[];
520
522
  minLength?: number;
521
523
  }) => {
522
524
  const { label, description } = FieldOptions.parse(schema.description || "");
@@ -21,13 +21,14 @@ import { Input } from "../ui/input";
21
21
  import { Tooltip } from "../ui/tooltip";
22
22
 
23
23
  const BASE_URL = "https://static.marimo.app";
24
-
25
24
  export const ShareStaticNotebookModal: React.FC<{
26
25
  onClose: () => void;
27
26
  }> = ({ onClose }) => {
28
27
  const [slug, setSlug] = useState("");
29
28
  const { exportAsHTML } = useRequestClient();
30
- // 4 character random string
29
+
30
+ // Keep one random suffix for the lifetime of the modal.
31
+ // oxlint-disable-next-line react/purity
31
32
  const randomHash = useMemo(() => Math.random().toString(36).slice(2, 6), []);
32
33
 
33
34
  // Globally unique path
@@ -17,6 +17,10 @@ export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
17
17
  endAdornment?: React.ReactNode;
18
18
  };
19
19
 
20
+ const DEFAULT_SEARCH_ICON = (
21
+ <SearchIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />
22
+ );
23
+
20
24
  const Input = React.forwardRef<HTMLInputElement, InputProps>(
21
25
  ({ className, type, endAdornment, ...props }, ref) => {
22
26
  const icon = props.icon;
@@ -120,7 +124,7 @@ export const SearchInput = React.forwardRef<
120
124
  {
121
125
  className,
122
126
  rootClassName,
123
- icon = <SearchIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />,
127
+ icon = DEFAULT_SEARCH_ICON,
124
128
  clearable = true,
125
129
  ...props
126
130
  },
@@ -24,6 +24,8 @@ import { sanitizeHtml, useSanitizeHtml } from "./sanitize";
24
24
  type ReplacementFn = NonNullable<HTMLReactParserOptions["replace"]>;
25
25
  type TransformFn = NonNullable<HTMLReactParserOptions["transform"]>;
26
26
 
27
+ const EMPTY_REPLACEMENTS: readonly ReplacementFn[] = [];
28
+
27
29
  interface Options {
28
30
  html: string;
29
31
  /**
@@ -31,7 +33,7 @@ interface Options {
31
33
  * @default true
32
34
  */
33
35
  alwaysSanitizeHtml?: boolean;
34
- additionalReplacements?: ReplacementFn[];
36
+ additionalReplacements?: readonly ReplacementFn[];
35
37
  }
36
38
 
37
39
  const replaceValidTags = (domNode: DOMNode) => {
@@ -299,7 +301,7 @@ const CopyableCode = ({ children }: { children: ReactNode }) => {
299
301
  */
300
302
  export const renderHTML = ({
301
303
  html,
302
- additionalReplacements = [],
304
+ additionalReplacements = EMPTY_REPLACEMENTS,
303
305
  alwaysSanitizeHtml = true,
304
306
  }: Options) => {
305
307
  return (
@@ -313,7 +315,7 @@ export const renderHTML = ({
313
315
 
314
316
  const RenderHTML = ({
315
317
  html,
316
- additionalReplacements = [],
318
+ additionalReplacements = EMPTY_REPLACEMENTS,
317
319
  alwaysSanitizeHtml,
318
320
  }: Options) => {
319
321
  const shouldSanitizeHtml = useSanitizeHtml();
@@ -333,7 +335,7 @@ const RenderHTML = ({
333
335
 
334
336
  function parseHtml({
335
337
  html,
336
- additionalReplacements = [],
338
+ additionalReplacements = EMPTY_REPLACEMENTS,
337
339
  }: Pick<Options, "html" | "additionalReplacements">) {
338
340
  const renderFunctions: ReplacementFn[] = [
339
341
  replaceValidTags,
@@ -27,6 +27,8 @@ export const LANGUAGE_MAP: Record<string, LanguageName | undefined> = {
27
27
  undefined: "text",
28
28
  };
29
29
 
30
+ const EMPTY_EXTENSIONS: readonly Extension[] = [];
31
+
30
32
  function isSupportedLanguage(
31
33
  language: string | undefined,
32
34
  ): language is LanguageName {
@@ -43,17 +45,18 @@ function isSupportedLanguage(
43
45
  * language support.
44
46
  */
45
47
  const AnyLanguageCodeMirror: React.FC<
46
- ReactCodeMirrorProps & {
48
+ Omit<ReactCodeMirrorProps, "extensions"> & {
47
49
  language: string | undefined;
48
50
  hideUnsupportedLanguageErrors?: boolean;
49
51
  theme: ResolvedTheme;
50
52
  showCopyButton?: boolean;
53
+ extensions?: readonly Extension[];
51
54
  }
52
55
  > = ({
53
56
  language,
54
57
  hideUnsupportedLanguageErrors,
55
58
  showCopyButton,
56
- extensions = [],
59
+ extensions = EMPTY_EXTENSIONS,
57
60
  ...props
58
61
  }) => {
59
62
  // Maybe normalize the language to the extension
@@ -64,7 +67,7 @@ const AnyLanguageCodeMirror: React.FC<
64
67
  Logger.warn(`Language ${language} not found in CodeMirror.`);
65
68
  }
66
69
 
67
- const finalExtensions = useMemo((): Extension[] => {
70
+ const finalExtensions = useMemo((): readonly Extension[] => {
68
71
  if (!isSupportedLanguage(language)) {
69
72
  return extensions;
70
73
  }
@@ -90,7 +93,7 @@ const AnyLanguageCodeMirror: React.FC<
90
93
  toastTitle="Copied to clipboard"
91
94
  />
92
95
  )}
93
- <ReactCodeMirror {...props} extensions={finalExtensions} />
96
+ <ReactCodeMirror {...props} extensions={[...finalExtensions]} />
94
97
  </div>
95
98
  );
96
99
  };
@@ -22,18 +22,22 @@ import { TooltipProvider } from "../components/ui/tooltip";
22
22
 
23
23
  type Story = StoryObj<typeof Cell>;
24
24
 
25
+ interface CellOverrides {
26
+ runElapsedTimeMs?: Milliseconds;
27
+ output?: CellRuntimeState["output"];
28
+ edited?: boolean;
29
+ interrupted?: boolean;
30
+ errored?: boolean;
31
+ status?: CellRuntimeState["status"];
32
+ staleInputs?: boolean;
33
+ config?: CellConfig;
34
+ }
35
+
36
+ const EMPTY_OVERRIDES: Readonly<CellOverrides> = {};
37
+
25
38
  const Cell: React.FC<{
26
- overrides?: {
27
- runElapsedTimeMs?: Milliseconds;
28
- output?: CellRuntimeState["output"];
29
- edited?: boolean;
30
- interrupted?: boolean;
31
- errored?: boolean;
32
- status?: CellRuntimeState["status"];
33
- staleInputs?: boolean;
34
- config?: CellConfig;
35
- };
36
- }> = ({ overrides = {} }) => {
39
+ overrides?: CellOverrides;
40
+ }> = ({ overrides = EMPTY_OVERRIDES }) => {
37
41
  const cid = cellId("1");
38
42
  const notebook: NotebookState = {
39
43
  cellData: {
@@ -1,76 +0,0 @@
1
- import "./rolldown-runtime-Cb76FRpK.js";
2
- import { g as e } from "./button-BeWeF5Z2.js";
3
- import { t } from "./react-DMWcHin-.js";
4
- import { t as n } from "./compiler-runtime-CAH9RLw2.js";
5
- import { t as r } from "./jsx-runtime-CpoKNRgu.js";
6
- import { n as i } from "./error-banner-C0gx40vn.js";
7
- import { f as a } from "./extends-G2pVMdwU.js";
8
- import { t as o } from "./esm-aqYR5Dl6.js";
9
- import { n as s, t as c } from "./esm-CR1nhb1c.js";
10
- //#region src/plugins/impl/code/any-language-editor.tsx
11
- var l = n();
12
- t();
13
- var u = r(), d = {
14
- python: "py",
15
- python3: "py",
16
- javascript: "js",
17
- typescript: "ts",
18
- shell: "sh",
19
- bash: "sh",
20
- unknown: "text",
21
- undefined: "text"
22
- };
23
- function f(e) {
24
- return e ? e in c : !1;
25
- }
26
- var p = (t) => {
27
- let n = (0, l.c)(29), r, p, m, h, g, _;
28
- if (n[0] !== t) {
29
- let { language: e, hideUnsupportedLanguageErrors: i, showCopyButton: a, extensions: o, ...s } = t;
30
- p = i, g = a, h = s, m = e;
31
- let c;
32
- n[7] === o ? c = n[8] : (c = o === void 0 ? [] : o, n[7] = o, n[8] = c), r = c, m = d[m || ""] || m, _ = f(m), n[0] = t, n[1] = r, n[2] = p, n[3] = m, n[4] = h, n[5] = g, n[6] = _;
33
- } else r = n[1], p = n[2], m = n[3], h = n[4], g = n[5], _ = n[6];
34
- let v = _;
35
- v || e.warn(`Language ${m} not found in CodeMirror.`);
36
- let y;
37
- bb0: {
38
- if (!f(m)) {
39
- y = r;
40
- break bb0;
41
- }
42
- let e;
43
- n[9] === m ? e = n[10] : (e = s(m), n[9] = m, n[10] = e);
44
- let t;
45
- n[11] !== r || n[12] !== e ? (t = [e, ...r].filter(Boolean), n[11] = r, n[12] = e, n[13] = t) : t = n[13], y = t;
46
- }
47
- let b = y, x;
48
- n[14] !== p || n[15] !== v || n[16] !== m ? (x = !v && !p && /* @__PURE__ */ (0, u.jsx)(i, {
49
- className: "mb-1 rounded-sm",
50
- error: `Language ${m} not supported. Supported languages are: ${Object.keys(c).join(", ")}`
51
- }), n[14] = p, n[15] = v, n[16] = m, n[17] = x) : x = n[17];
52
- let S;
53
- n[18] !== v || n[19] !== h || n[20] !== g ? (S = g && v && /* @__PURE__ */ (0, u.jsx)(a, {
54
- tooltip: !1,
55
- buttonClassName: "absolute top-2 right-2 z-10 hover-action",
56
- className: "h-4 w-4 text-muted-foreground",
57
- value: h.value || "",
58
- toastTitle: "Copied to clipboard"
59
- }), n[18] = v, n[19] = h, n[20] = g, n[21] = S) : S = n[21];
60
- let C;
61
- n[22] !== b || n[23] !== h ? (C = /* @__PURE__ */ (0, u.jsx)(o, {
62
- ...h,
63
- extensions: b
64
- }), n[22] = b, n[23] = h, n[24] = C) : C = n[24];
65
- let w;
66
- return n[25] !== x || n[26] !== S || n[27] !== C ? (w = /* @__PURE__ */ (0, u.jsxs)("div", {
67
- className: "relative w-full group hover-actions-parent",
68
- children: [
69
- x,
70
- S,
71
- C
72
- ]
73
- }), n[25] = x, n[26] = S, n[27] = C, n[28] = w) : w = n[28], w;
74
- };
75
- //#endregion
76
- export { d as LANGUAGE_MAP, p as default };