@marimo-team/islands 0.18.3 → 0.18.4

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.
@@ -701,27 +701,26 @@ function decodeIPC(e, x) {
701
701
  return tableFromIPC(e, x ?? { useProxy: true });
702
702
  }
703
703
  export {
704
- CircleQuestionMark as C,
705
- isWasm as S,
706
- appendQueryParams as _,
707
- AlertDescription as a,
708
- isStaticNotebook as b,
709
- toDate as c,
710
- millisecondsInHour as d,
711
- millisecondsInMinute as f,
712
- getRuntimeManager as g,
713
- asRemoteURL as h,
714
- Alert as i,
715
- constructFrom as l,
716
- millisecondsInWeek as m,
704
+ CircleQuestionMark as S,
705
+ isUrl as _,
706
+ AlertTitle as a,
707
+ Deferred as b,
708
+ constructFrom as c,
709
+ millisecondsInMinute as d,
710
+ millisecondsInSecond as f,
711
+ appendQueryParams as g,
712
+ getRuntimeManager as h,
713
+ AlertDescription as i,
714
+ millisecondsInDay as l,
715
+ asRemoteURL as m,
717
716
  useDeepCompareMemoize as n,
718
- AlertTitle as o,
719
- millisecondsInSecond as p,
720
- dequal as r,
721
- isValid as s,
717
+ isValid as o,
718
+ millisecondsInWeek as p,
719
+ Alert as r,
720
+ toDate as s,
722
721
  arrow as t,
723
- millisecondsInDay as u,
724
- isUrl as v,
725
- Deferred as x,
726
- require_cuid2 as y
722
+ millisecondsInHour as u,
723
+ require_cuid2 as v,
724
+ isWasm as x,
725
+ isStaticNotebook as y
727
726
  };
package/dist/main.js CHANGED
@@ -11,7 +11,7 @@ import { A as Badge, B as ListFilter, C as DEFAULT_COLOR_SCHEME, D as SCALE_TYPE
11
11
  import { t as Check } from "./check-IicTB7sO.js";
12
12
  import { A as logNever, B as ChevronDown, C as useDirection, D as useOnUnmount, E as useOnMount, F as $18f2051aff69b9bf$export$a54013f0d02a8f82, I as $b5e257d569688ac6$export$535bd6ca7f90a273, M as $a916eb452884faea$export$b7a616150fdb9f44, O as usePrevious, P as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7, R as X, S as Trigger$5, T as clamp$2, _ as menuItemVariants, a as SelectGroup, b as menuSubTriggerVariants, c as SelectSeparator, d as NativeSelect, f as selectStyles, h as menuControlCheckVariants, i as SelectContent, k as assertNever, l as SelectTrigger, m as menuContentCommon, n as Primitive, o as SelectItem, p as MENU_ITEM_DISABLED, r as Select, s as SelectLabel, t as Label, u as SelectValue, v as menuLabelVariants, w as createCollection, x as Icon, y as menuSeparatorVariants } from "./label-BtLFsS7L.js";
13
13
  import { $ as $514c0188e459b4c0$export$9afb8bc826b033ea, $t as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, A as Item2$2, At as $6db58dc88e78b024$export$2f817fcdc4b89ae0, B as SubTrigger, Bt as $458b0a5536c1a7cf$export$40bfa8c7b0832715, C as DropdownMenuSubTrigger, Ct as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, D as CheckboxItem, Dt as $6c7bd7858deea686$export$cd11ab140839f11d, E as Arrow2, Et as $701a24aa0da5b062$export$ea18c227d4417cc3, F as RadioItem, Ft as $507fabe10e71c6fb$export$630ff653c5ada6a9, G as $3985021b0ad6602f$export$37fb8590cf2c088c, Gt as $df56164dff5785e2$export$4338b53315abf666, H as Item$2, Ht as $b4b717babfbb907b$export$bebd5a1431fec25d, I as Root3, It as $f6c31cce2adf654f$export$45712eceda6fad21, J as $a049562f99e7db0e$export$f9c6924e160136d1, Jt as $c87311424ea30a05$export$78551043582a6a98, K as $3985021b0ad6602f$export$f5b8910cec6cf069, Kt as $313b98861ee5dd6c$export$d6875122194c7b44, L as Separator, Lt as _class_private_field_init, M as Label$2, Mt as $6179b936705e76d3$export$ae780daf29e6d456, N as Portal$2, Nt as $9ab94262bd0047c7$export$420e68273165f4ec, O as Content2$3, Ot as $fca6afa0e843324b$export$87b761675e8eaa10, P as RadioGroup$2, Pt as $3ad3f6e1647bc98d$export$80f3e147d781571c, Q as $514c0188e459b4c0$export$5f1af8db9871e1d6, Qt as $7215afc6de606d6b$export$de79e2c695e052f3, R as Sub, Rt as $ae1eeba8b9eafd08$export$5165eccb35aaadb5, S as DropdownMenuSubContent, St as $e5be200c675c3b3a$export$dad6ae84456c676a, T as Anchor2, Tt as $f7dceffc5ad7768b$export$4e328f61c538687f, U as Root$6, Ut as $99facab73266f662$export$5add1d006293d136, V as createMenuScope, Vt as $b4b717babfbb907b$export$4c063cf1350e6fed, W as createRovingFocusGroupScope, Wt as $e9faafb641e167db$export$90fc3a17d93f704c, X as $ee014567cb39d3f0$export$f551688fc98f2e09, Xt as $c87311424ea30a05$export$a11b0059900ceec8, Y as $d3e0e05bdfcf66bd$export$c24727297075ec6a, Yt as $c87311424ea30a05$export$9ac100e40613ea10, Z as $ee014567cb39d3f0$export$ff05c3ac10437e03, Zt as $c87311424ea30a05$export$fedb369cb70207f1, _ as DropdownMenuItem, _n as ChevronRight, _t as $2baaea4c71418dea$export$294aa081a6c6f55d, a as Input, an as $431fbd86ca7dc216$export$b204af158042fbac, at as $64fa3d84918910a7$export$2881499e37b75b9a, b as DropdownMenuSeparator, bt as $e5be200c675c3b3a$export$a763b9476acd3eb, c as maxFractionalDigits, cn as $bdb11010cef70236$export$b4cc09c592e8fdb8, ct as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, d as prettyScientificNumber, dn as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, dt as $64fa3d84918910a7$export$ef03459518577ad4, en as $3ef42575df84b30b$export$9d1611c77c2fe928, et as $d2b4bc8c273e7be6$export$24d547caef80ccd1, f as useDebounceControlledState, fn as Trash, ft as $64fa3d84918910a7$export$fabf2dc03a41866e, g as DropdownMenuGroup, gn as Circle, gt as $d2e8511e6f209edf$export$e908e06f4b8e3402, h as DropdownMenuContent, hn as Pencil, ht as capitalize_default, i as DebouncedNumberInput, in as $f4e2df6bd15f8569$export$98658e8c59125e6a, it as $f39a9eba43920ace$export$b5d7cc18bb8d2b59, j as ItemIndicator, jt as $5b160d28a433310d$export$c17fa47878dc55b6, k as Group$1, kt as $fca6afa0e843324b$export$f12b703ca79dfbb1, l as prettyEngineeringNumber, ln as $bdb11010cef70236$export$f680877a34711e37, lt as $64fa3d84918910a7$export$c245e6201fed2f75, m as DropdownMenu, mn as Plus, mt as marked, n as ErrorBoundary, nn as $d4ee10de306f2510$export$cd4e5573fbe2b576, nt as $01b77f81d0f07f68$export$75b6ee27786ba447, o as OnBlurredInput, on as $431fbd86ca7dc216$export$f21a1ffae260145a, ot as $64fa3d84918910a7$export$29f1550f4b0d4415, p as useDebouncedCallback, pn as Search, pt as useNonce, q as $a049562f99e7db0e$export$eb2fcfdbd7ba97d4, qt as $c87311424ea30a05$export$6446a186d09e379e, r as DebouncedInput, rn as $d4ee10de306f2510$export$e58f029f0fbfdb29, rt as $01b77f81d0f07f68$export$b04be29aa201d4f5, s as NumberField, sn as $ff5963eb1fccf552$export$e08e3b67e392101e, st as $64fa3d84918910a7$export$4d86445c2cf5e3, t as BulkEdit, tn as $d4ee10de306f2510$export$4282f70798064fe0, tt as $d2b4bc8c273e7be6$export$353f5b6fc5456de1, u as prettyNumber, un as $8ae05eaa5c114e9c$export$7f54fc3180508a52, ut as $64fa3d84918910a7$export$c62b8e45d58ddad9, v as DropdownMenuLabel, vt as $e93e671b31057976$export$b8473d3665f3a75a, w as DropdownMenuTrigger, wt as $319e236875307eab$export$a9b970dcc4ae71a9, x as DropdownMenuSub, xt as $e5be200c675c3b3a$export$aca958c65c314e6c, y as DropdownMenuPortal, yt as $e5be200c675c3b3a$export$75ee7c75d68f5b0e, z as SubContent, zt as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "./types-DclGb0Yh.js";
14
- import { C as CircleQuestionMark, S as isWasm, _ as appendQueryParams, a as AlertDescription, b as isStaticNotebook, c as toDate, d as millisecondsInHour, f as millisecondsInMinute, g as getRuntimeManager, h as asRemoteURL, i as Alert, l as constructFrom, m as millisecondsInWeek, n as useDeepCompareMemoize, o as AlertTitle, p as millisecondsInSecond, r as dequal, s as isValid, t as arrow, u as millisecondsInDay, v as isUrl, x as Deferred, y as require_cuid2 } from "./formats-4m4HuHTj.js";
14
+ import { S as CircleQuestionMark, _ as isUrl, a as AlertTitle, b as Deferred, c as constructFrom, d as millisecondsInMinute, f as millisecondsInSecond, g as appendQueryParams, h as getRuntimeManager, i as AlertDescription, l as millisecondsInDay, m as asRemoteURL, n as useDeepCompareMemoize, o as isValid, p as millisecondsInWeek, r as Alert, s as toDate, t as arrow, u as millisecondsInHour, v as require_cuid2, x as isWasm, y as isStaticNotebook } from "./formats-Bi_tbdwB.js";
15
15
  import { n as clsx_default } from "./clsx-D2KVTYnW.js";
16
16
  import { a as cva, c as useComposedRefs, l as Events, n as buttonVariants, o as useEventListener, r as Slot$1, s as composeRefs, t as Button, u as cn } from "./button-XnD6ylpt.js";
17
17
  import { c as Functions, i as parseShortcut, l as throwNotImplemented, o as Objects, r as isPlatformMac, s as Logger, t as NOT_SET } from "./hotkeys-CwkyZ6ZF.js";
@@ -49759,6 +49759,9 @@ To suppress this warning, you need to explicitly provide the \`palette.${r}Chann
49759
49759
  function typedAtob(e) {
49760
49760
  return window.atob(e);
49761
49761
  }
49762
+ function typedBtoa(e) {
49763
+ return window.btoa(e);
49764
+ }
49762
49765
  function isDataURLString(e) {
49763
49766
  return e.startsWith("data:") && e.includes(";base64,");
49764
49767
  }
@@ -49768,12 +49771,75 @@ To suppress this warning, you need to explicitly provide the \`palette.${r}Chann
49768
49771
  function byteStringToBinary(e) {
49769
49772
  return Uint8Array.from(e, (e2) => e2.charCodeAt(0));
49770
49773
  }
49774
+ function binaryToByteString(e) {
49775
+ let r = "";
49776
+ for (let c of e) r += String.fromCharCode(c);
49777
+ return r;
49778
+ }
49771
49779
  function safeExtractSetUIElementMessageBuffers(e) {
49772
49780
  return (e.buffers ?? []).map((e2) => {
49773
49781
  let r = byteStringToBinary(typedAtob(e2));
49774
49782
  return new DataView(r.buffer);
49775
49783
  });
49776
49784
  }
49785
+ function dataViewToBase64(e) {
49786
+ return typedBtoa(binaryToByteString(new Uint8Array(e.buffer, e.byteOffset, e.byteLength)));
49787
+ }
49788
+ function findDataViewPaths(e, r = []) {
49789
+ let c = [];
49790
+ if (e instanceof DataView) c.push(r);
49791
+ else if (Array.isArray(e)) for (let l = 0; l < e.length; l++) c.push(...findDataViewPaths(e[l], [
49792
+ ...r,
49793
+ l
49794
+ ]));
49795
+ else if (typeof e == "object" && e) for (let [l, d] of Object.entries(e)) c.push(...findDataViewPaths(d, [
49796
+ ...r,
49797
+ l
49798
+ ]));
49799
+ return c;
49800
+ }
49801
+ function serializeBuffersToBase64(e) {
49802
+ let r = findDataViewPaths(e);
49803
+ if (r.length === 0) return {
49804
+ state: e,
49805
+ buffers: [],
49806
+ bufferPaths: []
49807
+ };
49808
+ let c = structuredClone(e), l = [], d = [];
49809
+ for (let f of r) {
49810
+ let r2 = get_default(e, f);
49811
+ if (r2 instanceof DataView) {
49812
+ let e2 = dataViewToBase64(r2);
49813
+ l.push(e2), d.push(f), set_default(c, f, e2);
49814
+ }
49815
+ }
49816
+ return {
49817
+ state: c,
49818
+ buffers: l,
49819
+ bufferPaths: d
49820
+ };
49821
+ }
49822
+ function isWireFormat(e) {
49823
+ return typeof e == "object" && !!e && "state" in e && "bufferPaths" in e && "buffers" in e;
49824
+ }
49825
+ function decodeFromWire(e) {
49826
+ let { state: r, bufferPaths: c, buffers: l } = e;
49827
+ if (!c || c.length === 0) return r;
49828
+ l && invariant(l.length === c.length, "Buffers and buffer paths not the same length");
49829
+ let d = structuredClone(r);
49830
+ for (let [e2, r2] of c.entries()) {
49831
+ let c2 = l == null ? void 0 : l[e2];
49832
+ if (c2 == null) {
49833
+ Logger.warn("[anywidget] Could not find buffer at path", r2);
49834
+ continue;
49835
+ }
49836
+ if (typeof c2 == "string") {
49837
+ let e3 = byteStringToBinary(typedAtob(c2));
49838
+ set_default(d, r2, new DataView(e3.buffer));
49839
+ } else set_default(d, r2, c2);
49840
+ }
49841
+ return d;
49842
+ }
49777
49843
  const MODEL_MANAGER = new class {
49778
49844
  constructor(e = 1e4) {
49779
49845
  __publicField(this, "models", /* @__PURE__ */ new Map());
@@ -49808,7 +49874,12 @@ To suppress this warning, you need to explicitly provide the \`palette.${r}Chann
49808
49874
  var _a2;
49809
49875
  (_a2 = this.listeners[this.ANY_CHANGE_EVENT]) == null ? void 0 : _a2.forEach((e) => e());
49810
49876
  }, 0));
49811
- this.data = e, this.onChange = r, this.sendToWidget = c, this.dirtyFields = new Set(l);
49877
+ this.data = e, this.onChange = r, this.sendToWidget = c, this.dirtyFields = new Map([
49878
+ ...l
49879
+ ].map((e2) => [
49880
+ e2,
49881
+ this.data[e2]
49882
+ ]));
49812
49883
  }
49813
49884
  off(e, r) {
49814
49885
  var _a2;
@@ -49823,9 +49894,13 @@ To suppress this warning, you need to explicitly provide the \`palette.${r}Chann
49823
49894
  (_a2 = this.listeners[e]) == null ? void 0 : _a2.delete(r);
49824
49895
  }
49825
49896
  send(e, r, c) {
49826
- c && Logger.warn("buffers not supported in marimo anywidget.send"), this.sendToWidget({
49827
- content: e,
49828
- buffers: c
49897
+ let { state: l, bufferPaths: d, buffers: f } = serializeBuffersToBase64(e);
49898
+ this.sendToWidget({
49899
+ content: {
49900
+ state: l,
49901
+ bufferPaths: d
49902
+ },
49903
+ buffers: f
49829
49904
  }).then(r);
49830
49905
  }
49831
49906
  get(e) {
@@ -49835,19 +49910,17 @@ To suppress this warning, you need to explicitly provide the \`palette.${r}Chann
49835
49910
  this.data = {
49836
49911
  ...this.data,
49837
49912
  [e]: r
49838
- }, this.dirtyFields.add(e), this.emit(`change:${e}`, r), this.emitAnyChange();
49913
+ }, this.dirtyFields.set(e, r), this.emit(`change:${e}`, r), this.emitAnyChange();
49839
49914
  }
49840
49915
  save_changes() {
49841
49916
  if (this.dirtyFields.size === 0) return;
49842
- let e = {};
49843
- this.dirtyFields.forEach((r) => {
49844
- e[r] = this.data[r];
49845
- }), this.onChange(e);
49917
+ let e = Object.fromEntries(this.dirtyFields.entries());
49918
+ this.dirtyFields.clear(), this.onChange(e);
49846
49919
  }
49847
49920
  updateAndEmitDiffs(e) {
49848
- Object.keys(e).forEach((r) => {
49921
+ e != null && Object.keys(e).forEach((r) => {
49849
49922
  let c = r;
49850
- dequal(this.data[c], e[c]) || this.set(c, e[c]);
49923
+ this.data[c] !== e[c] && this.set(c, e[c]);
49851
49924
  });
49852
49925
  }
49853
49926
  receiveCustomMessage(e, r = []) {
@@ -49857,13 +49930,26 @@ To suppress this warning, you need to explicitly provide the \`palette.${r}Chann
49857
49930
  let e2 = c.data;
49858
49931
  switch (e2.method) {
49859
49932
  case "update":
49860
- this.updateAndEmitDiffs(e2.state);
49933
+ this.updateAndEmitDiffs(decodeFromWire({
49934
+ state: e2.state,
49935
+ bufferPaths: e2.buffer_paths ?? [],
49936
+ buffers: r
49937
+ }));
49861
49938
  break;
49862
49939
  case "custom":
49863
49940
  (_a2 = this.listeners["msg:custom"]) == null ? void 0 : _a2.forEach((c2) => c2(e2.content, r));
49864
49941
  break;
49865
49942
  case "open":
49866
- this.updateAndEmitDiffs(e2.state);
49943
+ this.updateAndEmitDiffs(decodeFromWire({
49944
+ state: e2.state,
49945
+ bufferPaths: e2.buffer_paths ?? [],
49946
+ buffers: r
49947
+ }));
49948
+ break;
49949
+ case "echo_update":
49950
+ break;
49951
+ default:
49952
+ Logger.error("[anywidget] Unknown message method", e2.method);
49867
49953
  break;
49868
49954
  }
49869
49955
  } else Logger.error("Failed to parse message", c.error), Logger.error("Message", e);
@@ -49904,34 +49990,40 @@ To suppress this warning, you need to explicitly provide the \`palette.${r}Chann
49904
49990
  const AnyWidgetPlugin = createPlugin("marimo-anywidget").withData(object$1({
49905
49991
  jsUrl: string$2(),
49906
49992
  jsHash: string$2(),
49907
- css: string$2().nullish(),
49908
- bufferPaths: array$2(array$2(union([
49909
- string$2(),
49910
- number$2()
49911
- ]))).nullish(),
49912
- initialValue: object$1({}).passthrough()
49993
+ css: string$2().nullish()
49913
49994
  })).withFunctions({
49914
49995
  send_to_widget: rpc.input(object$1({
49915
- content: any()
49996
+ content: unknown(),
49997
+ buffers: array$2(string$2().transform((e) => e))
49916
49998
  })).output(_null().optional())
49917
49999
  }).renderer((e) => (0, import_jsx_runtime.jsx)(AnyWidgetSlot, {
49918
50000
  ...e
49919
50001
  }));
49920
50002
  var AnyWidgetSlot = (e) => {
49921
50003
  var _a2;
49922
- let { css: r, jsUrl: c, jsHash: l, bufferPaths: d } = e.data, f = (0, import_react.useMemo)(() => resolveInitialValue(e.value, d ?? []), [
49923
- e.value,
49924
- d
49925
- ]), { data: h, error: g, refetch: v } = useAsyncData(async () => await import(asRemoteURL(c).toString()).then(async (m2) => {
50004
+ let { css: r, jsUrl: c, jsHash: l } = e.data, d = (0, import_react.useMemo)(() => {
50005
+ var _a3;
50006
+ if (isWireFormat(e.value)) {
50007
+ let r2 = decodeFromWire(e.value);
50008
+ return Logger.debug("AnyWidget decoded wire format:", {
50009
+ bufferPaths: e.value.bufferPaths,
50010
+ buffersCount: (_a3 = e.value.buffers) == null ? void 0 : _a3.length,
50011
+ decodedKeys: Object.keys(r2)
50012
+ }), r2;
50013
+ }
50014
+ return Logger.warn("AnyWidget value is not wire format:", e.value), e.value;
50015
+ }, [
50016
+ e.value
50017
+ ]), { data: f, error: h, refetch: g } = useAsyncData(async () => await import(asRemoteURL(c).toString()).then(async (m2) => {
49926
50018
  await m2.__tla;
49927
50019
  return m2;
49928
50020
  }), [
49929
50021
  l
49930
- ]), y = !!g;
49931
- if ((0, import_react.useEffect)(() => {
49932
- y && c && v();
50022
+ ]), v = !!h;
50023
+ (0, import_react.useEffect)(() => {
50024
+ v && c && g();
49933
50025
  }, [
49934
- y,
50026
+ v,
49935
50027
  c
49936
50028
  ]), (0, import_react.useEffect)(() => {
49937
50029
  let c2 = e.host.shadowRoot;
@@ -49955,18 +50047,21 @@ To suppress this warning, you need to explicitly provide the \`palette.${r}Chann
49955
50047
  }, [
49956
50048
  r,
49957
50049
  e.host
49958
- ]), g) return (0, import_jsx_runtime.jsx)(ErrorBanner, {
49959
- error: g
50050
+ ]);
50051
+ let y = useEvent_default((r2) => e.setValue(serializeBuffersToBase64(r2)));
50052
+ if (h) return (0, import_jsx_runtime.jsx)(ErrorBanner, {
50053
+ error: h
49960
50054
  });
49961
- if (!h) return null;
49962
- if (!isAnyWidgetModule(h)) return (0, import_jsx_runtime.jsx)(ErrorBanner, {
50055
+ if (!f) return null;
50056
+ if (!isAnyWidgetModule(f)) return (0, import_jsx_runtime.jsx)(ErrorBanner, {
49963
50057
  error: Error(`Module at ${c} does not appear to be a valid anywidget`)
49964
50058
  });
49965
50059
  let b = ((_a2 = e.host.closest("[random-id]")) == null ? void 0 : _a2.getAttribute("random-id")) ?? c;
49966
50060
  return (0, import_jsx_runtime.jsx)(LoadedSlot, {
49967
50061
  ...e,
49968
- widget: h.default,
49969
- value: f
50062
+ widget: f.default,
50063
+ setValue: y,
50064
+ value: d
49970
50065
  }, b);
49971
50066
  };
49972
50067
  async function runAnyWidgetModule(e, r, c) {
@@ -49983,70 +50078,61 @@ To suppress this warning, you need to explicitly provide the \`palette.${r}Chann
49983
50078
  model: r,
49984
50079
  experimental: l
49985
50080
  }));
49986
- let f = await ((_b2 = d.render) == null ? void 0 : _b2.call(d, {
49987
- model: r,
49988
- el: c,
49989
- experimental: l
49990
- }));
49991
- return () => {
49992
- f == null ? void 0 : f();
49993
- };
50081
+ try {
50082
+ let e2 = await ((_b2 = d.render) == null ? void 0 : _b2.call(d, {
50083
+ model: r,
50084
+ el: c,
50085
+ experimental: l
50086
+ }));
50087
+ return () => {
50088
+ e2 == null ? void 0 : e2();
50089
+ };
50090
+ } catch (e2) {
50091
+ return Logger.error("Error rendering anywidget", e2), c.classList.add("text-error"), c.innerHTML = `Error rendering anywidget: ${prettyError(e2)}`, () => {
50092
+ };
50093
+ }
49994
50094
  }
49995
50095
  function isAnyWidgetModule(e) {
49996
50096
  var _a2, _b2;
49997
50097
  return e.default && (typeof e.default == "function" || ((_a2 = e.default) == null ? void 0 : _a2.render) || ((_b2 = e.default) == null ? void 0 : _b2.initialize));
49998
50098
  }
49999
- function getDirtyFields$1(e, r) {
50000
- return new Set(Object.keys(e).filter((c) => !isEqual_default(e[c], r[c])));
50001
- }
50002
50099
  function hasModelId(e) {
50003
50100
  return typeof e == "object" && !!e && "model_id" in e;
50004
50101
  }
50005
50102
  var LoadedSlot = (e) => {
50006
- let r = (0, import_compiler_runtime$129.c)(15), { value: c, setValue: l, widget: d, functions: f, data: h, host: g } = e, v = (0, import_react.useRef)(null), y;
50007
- r[0] !== h.initialValue || r[1] !== f.send_to_widget || r[2] !== l || r[3] !== c ? (y = new Model({
50008
- ...h.initialValue,
50009
- ...c
50010
- }, l, f.send_to_widget, getDirtyFields$1(c, h.initialValue)), r[0] = h.initialValue, r[1] = f.send_to_widget, r[2] = l, r[3] = c, r[4] = y) : y = r[4];
50103
+ let r = (0, import_compiler_runtime$129.c)(14), { value: c, setValue: l, widget: d, functions: f, data: h, host: g } = e, v = (0, import_react.useRef)(null), y;
50104
+ r[0] !== f.send_to_widget || r[1] !== l || r[2] !== c ? (y = new Model(c, l, f.send_to_widget, /* @__PURE__ */ new Set()), r[0] = f.send_to_widget, r[1] = l, r[2] = c, r[3] = y) : y = r[3];
50011
50105
  let b = (0, import_react.useRef)(y), x;
50012
- r[5] === Symbol.for("react.memo_cache_sentinel") ? (x = (e2) => {
50106
+ r[4] === Symbol.for("react.memo_cache_sentinel") ? (x = (e2) => {
50013
50107
  let r2 = e2.detail.message;
50014
50108
  hasModelId(r2) ? MODEL_MANAGER.get(r2.model_id).then((c2) => {
50015
50109
  c2.receiveCustomMessage(r2, e2.detail.buffers);
50016
50110
  }) : b.current.receiveCustomMessage(r2, e2.detail.buffers);
50017
- }, r[5] = x) : x = r[5], useEventListener(g, MarimoIncomingMessageEvent.TYPE, x);
50111
+ }, r[4] = x) : x = r[4], useEventListener(g, MarimoIncomingMessageEvent.TYPE, x);
50018
50112
  let E;
50019
- r[6] === d ? E = r[7] : (E = () => {
50113
+ r[5] === d ? E = r[6] : (E = () => {
50020
50114
  if (!v.current) return;
50021
50115
  let e2 = runAnyWidgetModule(d, b.current, v.current);
50022
50116
  return () => {
50023
50117
  e2.then(_temp$34);
50024
50118
  };
50025
- }, r[6] = d, r[7] = E);
50119
+ }, r[5] = d, r[6] = E);
50026
50120
  let O;
50027
- r[8] !== h.jsUrl || r[9] !== d ? (O = [
50121
+ r[7] !== h.jsUrl || r[8] !== d ? (O = [
50028
50122
  d,
50029
50123
  h.jsUrl
50030
- ], r[8] = h.jsUrl, r[9] = d, r[10] = O) : O = r[10], (0, import_react.useEffect)(E, O);
50124
+ ], r[7] = h.jsUrl, r[8] = d, r[9] = O) : O = r[9], (0, import_react.useEffect)(E, O);
50031
50125
  let A = useDeepCompareMemoize(c), I, R;
50032
- r[11] === A ? (I = r[12], R = r[13]) : (I = () => {
50126
+ r[10] === A ? (I = r[11], R = r[12]) : (I = () => {
50033
50127
  b.current.updateAndEmitDiffs(A);
50034
50128
  }, R = [
50035
50129
  A
50036
- ], r[11] = A, r[12] = I, r[13] = R), (0, import_react.useEffect)(I, R);
50130
+ ], r[10] = A, r[11] = I, r[12] = R), (0, import_react.useEffect)(I, R);
50037
50131
  let z;
50038
- return r[14] === Symbol.for("react.memo_cache_sentinel") ? (z = (0, import_jsx_runtime.jsx)("div", {
50132
+ return r[13] === Symbol.for("react.memo_cache_sentinel") ? (z = (0, import_jsx_runtime.jsx)("div", {
50039
50133
  ref: v
50040
- }), r[14] = z) : z = r[14], z;
50134
+ }), r[13] = z) : z = r[13], z;
50041
50135
  };
50042
- function resolveInitialValue(e, r) {
50043
- let c = structuredClone(e);
50044
- for (let l of r) {
50045
- let r2 = byteStringToBinary(typedAtob(get_default(e, l)));
50046
- set_default(c, l, new DataView(r2.buffer));
50047
- }
50048
- return c;
50049
- }
50050
50136
  function _temp$34(e) {
50051
50137
  return e();
50052
50138
  }
@@ -59564,12 +59650,16 @@ Database schema: ${c}`), (_a3 = r2.aiFix) == null ? void 0 : _a3.setAiCompletion
59564
59650
  operator: "is_false",
59565
59651
  value: void 0
59566
59652
  };
59567
- case "select":
59568
- return {
59653
+ case "select": {
59654
+ let e2 = r.operator;
59655
+ return r.operator !== "in" && r.operator !== "not_in" && (Logger.warn("Invalid operator for select filter", {
59656
+ operator: r.operator
59657
+ }), e2 = "in"), {
59569
59658
  column_id: c,
59570
- operator: "in",
59659
+ operator: e2,
59571
59660
  value: r.options
59572
59661
  };
59662
+ }
59573
59663
  default:
59574
59664
  assertNever(r);
59575
59665
  }
@@ -64825,9 +64915,12 @@ ${r}
64825
64915
  if (e.type === "time") return formatMinMax(e.min ? r.format(e.min) : void 0, e.max ? r.format(e.max) : void 0);
64826
64916
  if (e.type === "datetime") return formatMinMax((_c2 = e.min) == null ? void 0 : _c2.toISOString(), (_d2 = e.max) == null ? void 0 : _d2.toISOString());
64827
64917
  if (e.type === "boolean") return `is ${e.value ? "True" : "False"}`;
64828
- if (e.type === "select") return `is in [${e.options.map((e2) => stringifyUnknownValue({
64829
- value: e2
64830
- })).join(", ")}]`;
64918
+ if (e.type === "select") {
64919
+ let r2 = e.options.map((e2) => stringifyUnknownValue({
64920
+ value: e2
64921
+ }));
64922
+ return `${e.operator === "in" ? "is in" : "not in"} [${r2.join(", ")}]`;
64923
+ }
64831
64924
  if (e.type === "text") return `contains "${e.text}"`;
64832
64925
  logNever(e);
64833
64926
  }
@@ -65884,7 +65977,14 @@ ${r}
65884
65977
  } catch (e2) {
65885
65978
  Logger.error("Failed to copy context menu cell", e2);
65886
65979
  }
65887
- }, f = l.column, h = f.getCanFilter() && ((_a2 = f.columnDef.meta) == null ? void 0 : _a2.filterType);
65980
+ }, f = l.column, h = f.getCanFilter() && ((_a2 = f.columnDef.meta) == null ? void 0 : _a2.filterType), g = (e2) => {
65981
+ f.setFilterValue(Filter.select({
65982
+ options: [
65983
+ l.getValue()
65984
+ ],
65985
+ operator: e2
65986
+ }));
65987
+ };
65888
65988
  return (0, import_jsx_runtime.jsxs)(ContextMenuContent, {
65889
65989
  children: [
65890
65990
  (0, import_jsx_runtime.jsxs)(ContextMenuItem, {
@@ -65909,20 +66009,22 @@ ${r}
65909
66009
  children: [
65910
66010
  (0, import_jsx_runtime.jsx)(ContextMenuSeparator, {}),
65911
66011
  (0, import_jsx_runtime.jsxs)(ContextMenuItem, {
65912
- onClick: () => {
65913
- f.setFilterValue(Filter.select({
65914
- options: [
65915
- l.getValue()
65916
- ],
65917
- operator: "in"
65918
- }));
65919
- },
66012
+ onClick: () => g("in"),
65920
66013
  children: [
65921
66014
  (0, import_jsx_runtime.jsx)(Funnel, {
65922
66015
  className: "mo-dropdown-icon h-3 w-3"
65923
66016
  }),
65924
66017
  "Filter by this value"
65925
66018
  ]
66019
+ }),
66020
+ (0, import_jsx_runtime.jsxs)(ContextMenuItem, {
66021
+ onClick: () => g("not_in"),
66022
+ children: [
66023
+ (0, import_jsx_runtime.jsx)(Funnel, {
66024
+ className: "mo-dropdown-icon h-3 w-3"
66025
+ }),
66026
+ "Remove rows with this value"
66027
+ ]
65926
66028
  })
65927
66029
  ]
65928
66030
  })
@@ -79929,6 +80031,9 @@ ${c}
79929
80031
  in: [
79930
80032
  Schema.stringMultiColumnValues
79931
80033
  ],
80034
+ not_in: [
80035
+ Schema.stringMultiColumnValues
80036
+ ],
79932
80037
  is_null: [],
79933
80038
  is_not_null: []
79934
80039
  }, ALL_OPERATORS = {
@@ -91906,7 +92011,7 @@ ${c}
91906
92011
  return true;
91907
92012
  }
91908
92013
  }
91909
- var LazyVegaComponent = import_react.lazy(() => import("./vega-component-HUc7bIGs.js")), VegaPlugin = class {
92014
+ var LazyVegaComponent = import_react.lazy(() => import("./vega-component-BFcH2SqR.js")), VegaPlugin = class {
91910
92015
  constructor() {
91911
92016
  __publicField(this, "tagName", "marimo-vega");
91912
92017
  __publicField(this, "validator", object$1({
@@ -94332,7 +94437,8 @@ Defaulting to \`null\`.`;
94332
94437
  target_direction: _enum([
94333
94438
  "increase",
94334
94439
  "decrease"
94335
- ]).default("increase")
94440
+ ]).default("increase"),
94441
+ slot: any().optional()
94336
94442
  }));
94337
94443
  }
94338
94444
  render({ data: e }) {
@@ -94342,60 +94448,83 @@ Defaulting to \`null\`.`;
94342
94448
  }
94343
94449
  };
94344
94450
  const StatComponent = (e) => {
94345
- let r = (0, import_compiler_runtime$9.c)(23), { value: c, label: l, caption: d, bordered: f, direction: h, target_direction: g } = e, { locale: v } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7(), y;
94346
- r[0] !== v || r[1] !== c ? (y = () => c == null ? (0, import_jsx_runtime.jsx)("i", {
94451
+ let r = (0, import_compiler_runtime$9.c)(31), { value: c, label: l, caption: d, bordered: f, direction: h, target_direction: g, slot: v } = e, { locale: y } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7(), b;
94452
+ r[0] !== y || r[1] !== c ? (b = () => c == null ? (0, import_jsx_runtime.jsx)("i", {
94347
94453
  children: "No value"
94348
- }) : typeof c == "string" ? c : typeof c == "number" ? prettyNumber(c, v) : typeof c == "boolean" ? c ? "True" : "False" : String(c), r[0] = v, r[1] = c, r[2] = y) : y = r[2];
94349
- let b = y, x = h === g, E = x ? "var(--grass-8)" : "var(--red-8)", O = x ? "var(--grass-9)" : "var(--red-9)", A = f && "rounded-xl border shadow bg-card", I;
94350
- r[3] === A ? I = r[4] : (I = cn("text-card-foreground", A), r[3] = A, r[4] = I);
94351
- let R;
94352
- r[5] === l ? R = r[6] : (R = l && (0, import_jsx_runtime.jsx)("div", {
94353
- className: "p-6 flex flex-row items-center justify-between space-y-0 pb-2",
94454
+ }) : typeof c == "string" ? c : typeof c == "number" ? prettyNumber(c, y) : typeof c == "boolean" ? c ? "True" : "False" : String(c), r[0] = y, r[1] = c, r[2] = b) : b = r[2];
94455
+ let x = b, E = h === g, O = E ? "var(--grass-8)" : "var(--red-8)", A = E ? "var(--grass-9)" : "var(--red-9)", I;
94456
+ r[3] === v ? I = r[4] : (I = () => {
94457
+ let e2 = getMimeValues(v);
94458
+ if (e2 == null ? void 0 : e2[0]) {
94459
+ let { mimetype: r2, data: c2 } = e2[0];
94460
+ return r2 !== "text/html" && Logger.warn(`Expected text/html, got ${r2}`), renderHTML({
94461
+ html: c2,
94462
+ alwaysSanitizeHtml: true
94463
+ });
94464
+ }
94465
+ }, r[3] = v, r[4] = I);
94466
+ let R = I, z = f && "rounded-xl border shadow bg-card", B;
94467
+ r[5] === z ? B = r[6] : (B = cn("text-card-foreground p-6", z), r[5] = z, r[6] = B);
94468
+ let K;
94469
+ r[7] === l ? K = r[8] : (K = l && (0, import_jsx_runtime.jsx)("div", {
94470
+ className: "flex flex-row items-center justify-between space-y-0 pb-2",
94354
94471
  children: (0, import_jsx_runtime.jsx)("h3", {
94355
94472
  className: "tracking-tight text-sm font-medium",
94356
94473
  children: l
94357
94474
  })
94358
- }), r[5] = l, r[6] = R);
94359
- let z;
94360
- r[7] === b ? z = r[8] : (z = b(), r[7] = b, r[8] = z);
94361
- let B;
94362
- r[9] === z ? B = r[10] : (B = (0, import_jsx_runtime.jsx)("div", {
94475
+ }), r[7] = l, r[8] = K);
94476
+ let q;
94477
+ r[9] === x ? q = r[10] : (q = x(), r[9] = x, r[10] = q);
94478
+ let BY;
94479
+ r[11] === q ? BY = r[12] : (BY = (0, import_jsx_runtime.jsx)("div", {
94363
94480
  className: "text-2xl font-bold",
94364
- children: z
94365
- }), r[9] = z, r[10] = B);
94366
- let K;
94367
- r[11] !== d || r[12] !== h || r[13] !== E || r[14] !== O ? (K = d && (0, import_jsx_runtime.jsxs)("p", {
94368
- className: "pt-1 text-xs text-muted-foreground flex align-center",
94481
+ children: q
94482
+ }), r[11] = q, r[12] = BY);
94483
+ let VY;
94484
+ r[13] !== d || r[14] !== h || r[15] !== O || r[16] !== A ? (VY = d && (0, import_jsx_runtime.jsxs)("p", {
94485
+ className: "pt-1 text-xs text-muted-foreground flex align-center whitespace-nowrap",
94369
94486
  children: [
94370
94487
  h === "increase" && (0, import_jsx_runtime.jsx)(Triangle, {
94371
94488
  className: "w-4 h-4 mr-1 p-0.5",
94372
- fill: E,
94373
- stroke: O
94489
+ fill: O,
94490
+ stroke: A
94374
94491
  }),
94375
94492
  h === "decrease" && (0, import_jsx_runtime.jsx)(Triangle, {
94376
94493
  className: "w-4 h-4 mr-1 p-0.5 transform rotate-180",
94377
- fill: E,
94378
- stroke: O
94494
+ fill: O,
94495
+ stroke: A
94379
94496
  }),
94380
94497
  d
94381
94498
  ]
94382
- }), r[11] = d, r[12] = h, r[13] = E, r[14] = O, r[15] = K) : K = r[15];
94383
- let q;
94384
- r[16] !== B || r[17] !== K ? (q = (0, import_jsx_runtime.jsxs)("div", {
94385
- className: "p-6 pt-0",
94499
+ }), r[13] = d, r[14] = h, r[15] = O, r[16] = A, r[17] = VY) : VY = r[17];
94500
+ let HY;
94501
+ r[18] !== BY || r[19] !== VY ? (HY = (0, import_jsx_runtime.jsxs)("div", {
94386
94502
  children: [
94387
- B,
94388
- K
94503
+ BY,
94504
+ VY
94389
94505
  ]
94390
- }), r[16] = B, r[17] = K, r[18] = q) : q = r[18];
94391
- let BY;
94392
- return r[19] !== I || r[20] !== R || r[21] !== q ? (BY = (0, import_jsx_runtime.jsxs)("div", {
94393
- className: I,
94506
+ }), r[18] = BY, r[19] = VY, r[20] = HY) : HY = r[20];
94507
+ let UY;
94508
+ r[21] !== R || r[22] !== v ? (UY = v && (0, import_jsx_runtime.jsx)("div", {
94509
+ className: "[--slot:true]",
94510
+ children: R()
94511
+ }), r[21] = R, r[22] = v, r[23] = UY) : UY = r[23];
94512
+ let WY;
94513
+ r[24] !== UY || r[25] !== HY ? (WY = (0, import_jsx_runtime.jsxs)("div", {
94514
+ className: "pt-0 flex flex-row gap-3.5",
94394
94515
  children: [
94395
- R,
94396
- q
94516
+ HY,
94517
+ UY
94518
+ ]
94519
+ }), r[24] = UY, r[25] = HY, r[26] = WY) : WY = r[26];
94520
+ let GY;
94521
+ return r[27] !== WY || r[28] !== B || r[29] !== K ? (GY = (0, import_jsx_runtime.jsxs)("div", {
94522
+ className: B,
94523
+ children: [
94524
+ K,
94525
+ WY
94397
94526
  ]
94398
- }), r[19] = I, r[20] = R, r[21] = q, r[22] = BY) : BY = r[22], BY;
94527
+ }), r[27] = WY, r[28] = B, r[29] = K, r[30] = GY) : GY = r[30], GY;
94399
94528
  };
94400
94529
  var import_compiler_runtime$8 = require_compiler_runtime(), TexPlugin = class {
94401
94530
  constructor() {
@@ -98404,7 +98533,7 @@ Defaulting to \`null\`.`;
98404
98533
  return Logger.warn("Failed to get version from mount config"), null;
98405
98534
  }
98406
98535
  }
98407
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.18.3"), showCodeInRunModeAtom = atom(true);
98536
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.18.4"), showCodeInRunModeAtom = atom(true);
98408
98537
  atom(null);
98409
98538
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
98410
98539
  constructor() {