@marimo-team/islands 0.25.3-dev259 → 0.25.3-dev261
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.
- package/dist/{ConnectedDataExplorerComponent-DGOAQFtf.js → ConnectedDataExplorerComponent-DjlwdMQT.js} +1 -1
- package/dist/{ErrorBoundary-Ca_6JrtT.js → ErrorBoundary-m3vF1P4J.js} +1 -1
- package/dist/{chat-ui-zbfp80GW.js → chat-ui-Bl_I-evE.js} +3 -3
- package/dist/{code-visibility-DnDS4v5C.js → code-visibility-TqQbHmZ5.js} +2 -2
- package/dist/{common-D7-33xPq.js → common-BY_oazL9.js} +4 -4
- package/dist/{createReducer-Bx81cw8_.js → createReducer-C_syF8Td.js} +17 -13
- package/dist/{data-grid-overlay-editor-D6cRJh_Y.js → data-grid-overlay-editor-CLQPFjyJ.js} +1 -1
- package/dist/{error-entries-BuIE3Ius.js → error-entries-DFhMo601.js} +1 -1
- package/dist/{feedback-button-B0-v6Kkx.js → feedback-button-DYk1f0In.js} +3 -3
- package/dist/{glide-data-editor-BSKoRV9o.js → glide-data-editor-D30zzaiO.js} +3 -3
- package/dist/{globals-CihZM8xT.js → globals-BA0s7TxM.js} +1 -1
- package/dist/{html-to-image-BXrAd5q8.js → html-to-image-BPs9Vo-H.js} +2 -2
- package/dist/main.js +12 -12
- package/dist/{number-overlay-editor-BUXqdm7X.js → number-overlay-editor-B1nffNQ2.js} +1 -1
- package/dist/{process-output-D2ZjxrHe.js → process-output-c6xaHokq.js} +2 -2
- package/dist/{reveal-component-4D-84xpO.js → reveal-component-fg3-aYjk.js} +3 -3
- package/package.json +1 -1
- package/src/components/data-table/column-formatting/types.ts +1 -2
- package/src/utils/__tests__/createReducer.test.tsx +100 -3
- package/src/utils/createReducer.ts +89 -80
|
@@ -14,7 +14,7 @@ import { n as ae } from "./useTheme-BZ2GGLgm.js";
|
|
|
14
14
|
import { T as oe, w as se, x as ce, y as le } from "./utils-DXkj82sK.js";
|
|
15
15
|
import { t as ue } from "./invariant-DLmrl-hA.js";
|
|
16
16
|
import { t as de } from "./objects-DCmMvZtn.js";
|
|
17
|
-
import { t as fe } from "./createReducer-
|
|
17
|
+
import { t as fe } from "./createReducer-C_syF8Td.js";
|
|
18
18
|
import { t as pe } from "./useAsyncData-DsZMvNXn.js";
|
|
19
19
|
import { D as me } from "./vega-loader.browser-B9Pz0EGP.js";
|
|
20
20
|
import { n as he, r as ge } from "./react-vega-C4T9Rb_w.js";
|
|
@@ -135,7 +135,7 @@ function F(e) {
|
|
|
135
135
|
}
|
|
136
136
|
//#endregion
|
|
137
137
|
//#region src/components/editor/boundary/ErrorBoundary.tsx
|
|
138
|
-
var I = (0, T.lazy)(() => import("./feedback-button-
|
|
138
|
+
var I = (0, T.lazy)(() => import("./feedback-button-DYk1f0In.js").then((e) => ({ default: e.FeedbackModal }))), L = (e) => {
|
|
139
139
|
let t = (0, w.c)(2), n;
|
|
140
140
|
return t[0] === e.children ? n = t[1] : (n = /* @__PURE__ */ (0, j.jsx)(O, {
|
|
141
141
|
FallbackComponent: R,
|
|
@@ -3,13 +3,13 @@ import { c as n, g as r, h as i, t as a } from "./button-0-RqY1DW.js";
|
|
|
3
3
|
import { t as o } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as s } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { i as c, t as l } from "./copy-icon-DD8bdw4L.js";
|
|
6
|
-
import { Dt as u, G as d, Ht as f, I as p, J as m, Kt as h, Nt as g, Pt as _, Q as v, S as y, Tt as b, Vt as x, _ as S, a as C, b as w, dt as T, f as E, ft as ee, g as D, h as te, ht as ne, it as re, l as ie, lt as ae, m as O, n as oe, p as k, q as se, r as ce, t as le, u as ue, ut as de, v as fe, y as pe, yt as me, zt as he } from "./html-to-image-
|
|
6
|
+
import { Dt as u, G as d, Ht as f, I as p, J as m, Kt as h, Nt as g, Pt as _, Q as v, S as y, Tt as b, Vt as x, _ as S, a as C, b as w, dt as T, f as E, ft as ee, g as D, h as te, ht as ne, it as re, l as ie, lt as ae, m as O, n as oe, p as k, q as se, r as ce, t as le, u as ue, ut as de, v as fe, y as pe, yt as me, zt as he } from "./html-to-image-BPs9Vo-H.js";
|
|
7
7
|
import { m as A, t as ge } from "./tooltip-Bzl4k00l.js";
|
|
8
8
|
import { M as _e, d as ve } from "./select-CcidPqlM.js";
|
|
9
9
|
import { _ as ye, f as be, h as xe, i as Se, n as Ce, t as we } from "./dropdown-menu-Blu7V6Mk.js";
|
|
10
10
|
import { a as Te, l as Ee } from "./config-mwEjAmvP.js";
|
|
11
|
-
import { F as De, G as Oe, M as ke, et as Ae, h as je, i as Me, r as Ne, st as Pe, t as Fe, wt as Ie, zt as Le } from "./error-entries-
|
|
12
|
-
import { d as Re, f as ze, i as Be, n as Ve, t as He, u as Ue } from "./process-output-
|
|
11
|
+
import { F as De, G as Oe, M as ke, et as Ae, h as je, i as Me, r as Ne, st as Pe, t as Fe, wt as Ie, zt as Le } from "./error-entries-DFhMo601.js";
|
|
12
|
+
import { d as Re, f as ze, i as Be, n as Ve, t as He, u as Ue } from "./process-output-c6xaHokq.js";
|
|
13
13
|
import { i as We, s as Ge, t as Ke } from "./strings-BYJNyKmg.js";
|
|
14
14
|
import { t as qe } from "./jsx-runtime-3BD1kT0s.js";
|
|
15
15
|
import { n as Je } from "./error-banner-DbRFOd2O.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as e } from "./button-0-RqY1DW.js";
|
|
2
|
-
import { A as t, E as n } from "./error-entries-
|
|
2
|
+
import { A as t, E as n } from "./error-entries-DFhMo601.js";
|
|
3
3
|
import { i as r } from "./strings-BYJNyKmg.js";
|
|
4
4
|
import { i, s as a, t as o, w as s, x as c } from "./utils-DXkj82sK.js";
|
|
5
5
|
import { c as l, m as u, n as d, o as f } from "./static-state-BldGd99T.js";
|
|
@@ -17,7 +17,7 @@ function b() {
|
|
|
17
17
|
return e.warn("Failed to get version from mount config"), null;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
var x = b() || "0.25.3-
|
|
20
|
+
var x = b() || "0.25.3-dev261", S = s(x), C = s(!0);
|
|
21
21
|
s(null);
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/core/wasm/state.ts
|
|
@@ -3,7 +3,7 @@ import { _ as t, c as n, f as r, g as i, h as a, m as o, n as s, p as c, s as l,
|
|
|
3
3
|
import { t as d } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as f } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { i as p, n as m, r as h, t as g } from "./copy-icon-DD8bdw4L.js";
|
|
6
|
-
import { C as _, D as v, E as y, G as b, Ht as x, I as S, It as C, J as w, Jt as T, K as E, Kt as D, L as O, N as k, Nt as A, O as j, Ot as M, P as N, Pt as P, Rt as F, T as I, U as L, Ut as R, Vt as z, X as B, Xt as V, Y as ee, Yt as H, _ as te, _t as ne, b as re, bt as ie, ct as ae, d as oe, et as se, gt as ce, it as le, j as ue, n as de, ot as fe, q as pe, qt as me, r as he, s as ge, st as _e, t as ve, v as ye, vt as be, y as xe, zt as Se } from "./html-to-image-
|
|
6
|
+
import { C as _, D as v, E as y, G as b, Ht as x, I as S, It as C, J as w, Jt as T, K as E, Kt as D, L as O, N as k, Nt as A, O as j, Ot as M, P as N, Pt as P, Rt as F, T as I, U as L, Ut as R, Vt as z, X as B, Xt as V, Y as ee, Yt as H, _ as te, _t as ne, b as re, bt as ie, ct as ae, d as oe, et as se, gt as ce, it as le, j as ue, n as de, ot as fe, q as pe, qt as me, r as he, s as ge, st as _e, t as ve, v as ye, vt as be, y as xe, zt as Se } from "./html-to-image-BPs9Vo-H.js";
|
|
7
7
|
import { a as Ce, d as we, m as U, n as Te, o as Ee, r as De, t as Oe } from "./tooltip-Bzl4k00l.js";
|
|
8
8
|
import { r as ke, s as Ae } from "./useLifecycle-GNgvNwI-.js";
|
|
9
9
|
import { a as je, i as Me, n as Ne, o as Pe, r as Fe, t as Ie } from "./useDateFormatter-CYo5fm8s.js";
|
|
@@ -11,8 +11,8 @@ import { t as Le } from "./check-CSvxZk5I.js";
|
|
|
11
11
|
import { A as Re, C as ze, M as Be, S as Ve, T as He, _ as Ue, b as We, c as Ge, d as Ke, f as qe, g as Je, h as Ye, i as Xe, l as Ze, m as Qe, n as $e, s as et, t as tt, u as nt, v as rt, x as it, y as at } from "./select-CcidPqlM.js";
|
|
12
12
|
import { $ as ot, $t as st, A as ct, At as lt, B as ut, Bt as dt, C as ft, Ct as pt, D as mt, Dt as ht, E as gt, Et as _t, F as vt, Ft as yt, G as bt, Gt as xt, H as St, Ht as Ct, I as wt, It as Tt, Jt as Et, K as Dt, Kt as Ot, L as kt, Lt as At, M as jt, Mt, N as Nt, Nt as Pt, O as Ft, Ot as It, P as Lt, Pt as Rt, Q as zt, Qt as Bt, R as Vt, Rt as Ht, S as Ut, St as Wt, T as Gt, Tt as Kt, U as qt, Ut as Jt, V as Yt, Vt as Xt, W as Zt, Wt as Qt, X as $t, Xt as en, Yt as tn, Z as nn, Zt as rn, _ as an, _n as on, _t as sn, a as cn, an as ln, at as un, b as dn, bn as fn, bt as pn, cn as mn, ct as hn, d as gn, dn as _n, dt as vn, en as yn, et as bn, f as xn, ft as Sn, gn as Cn, gt as wn, h as Tn, hn as En, ht as Dn, i as On, it as kn, j as An, jt as jn, k as Mn, kt as Nn, l as Pn, lt as Fn, mn as In, mt as Ln, n as Rn, nn as zn, nt as Bn, o as Vn, on as Hn, ot as Un, pn as Wn, q as Gn, qt as Kn, rn as qn, rt as Jn, s as Yn, sn as Xn, st as Zn, t as Qn, tn as $n, tt as er, u as tr, un as nr, ut as rr, vn as ir, vt as ar, wt as or, x as sr, xn as cr, xt as lr, yn as ur, yt as dr, z as fr, zt as pr } from "./dropdown-menu-Blu7V6Mk.js";
|
|
13
13
|
import { a as mr, n as hr, r as gr, t as _r } from "./config-mwEjAmvP.js";
|
|
14
|
-
import { A as vr, E as yr, G as br, H as xr, I as Sr, Lt as Cr, Nt as wr, Q as Tr, Rt as Er, T as Dr, Tt as Or, U as kr, V as Ar, b as jr, et as Mr, h as Nr, j as Pr, l as Fr, q as Ir, st as Lr, t as Rr, tt as zr, u as Br, wt as Vr, y as Hr, zt as Ur } from "./error-entries-
|
|
15
|
-
import { n as Wr, t as Gr } from "./ErrorBoundary-
|
|
14
|
+
import { A as vr, E as yr, G as br, H as xr, I as Sr, Lt as Cr, Nt as wr, Q as Tr, Rt as Er, T as Dr, Tt as Or, U as kr, V as Ar, b as jr, et as Mr, h as Nr, j as Pr, l as Fr, q as Ir, st as Lr, t as Rr, tt as zr, u as Br, wt as Vr, y as Hr, zt as Ur } from "./error-entries-DFhMo601.js";
|
|
15
|
+
import { n as Wr, t as Gr } from "./ErrorBoundary-m3vF1P4J.js";
|
|
16
16
|
import { i as Kr, r as qr, s as Jr, t as Yr } from "./strings-BYJNyKmg.js";
|
|
17
17
|
import { t as Xr } from "./clsx-CoeGtWvn.js";
|
|
18
18
|
import { t as Zr } from "./react-dom-DUmH0GXv.js";
|
|
@@ -25,7 +25,7 @@ import { a as ki, f as Ai, i as ji, l as Mi, n as Ni, u as Pi } from "./useTheme
|
|
|
25
25
|
import { C as Fi, D as Ii, E as Li, S as Ri, _ as zi, b as Bi, f as Vi, h as Hi, l as Ui, o as Wi, u as Gi, w as Ki, x as qi, y as Ji } from "./utils-DXkj82sK.js";
|
|
26
26
|
import { t as Yi } from "./invariant-DLmrl-hA.js";
|
|
27
27
|
import { t as Xi } from "./objects-DCmMvZtn.js";
|
|
28
|
-
import { t as Zi } from "./createReducer-
|
|
28
|
+
import { t as Zi } from "./createReducer-C_syF8Td.js";
|
|
29
29
|
import { V as Qi } from "./dist-CYeqK4Xw.js";
|
|
30
30
|
import { c as $i, d as ea, f as ta, m as na, n as ra, p as ia, s as aa, u as oa } from "./static-state-BldGd99T.js";
|
|
31
31
|
import { a as sa, i as ca, n as la, r as ua, t as da } from "./formats-gGospKWJ.js";
|
|
@@ -4,16 +4,17 @@ import { S as n, w as r } from "./utils-DXkj82sK.js";
|
|
|
4
4
|
//#region src/utils/createReducer.ts
|
|
5
5
|
var i = t();
|
|
6
6
|
function a(t, n) {
|
|
7
|
+
let r = n;
|
|
7
8
|
return {
|
|
8
|
-
reducer: (
|
|
9
|
+
reducer: (n, i) => (n ||= t(), i.type in r ? r[i.type](n, i.payload) : (e.error(`Action type ${i.type} is not defined in reducers.`), n)),
|
|
9
10
|
createActions: (e) => {
|
|
10
|
-
let t = {}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type: r,
|
|
11
|
+
let t = {}, n = (n) => {
|
|
12
|
+
t[n] = (t) => e({
|
|
13
|
+
type: n,
|
|
14
14
|
payload: t
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
+
for (let e in r) n(e);
|
|
17
18
|
return t;
|
|
18
19
|
}
|
|
19
20
|
};
|
|
@@ -38,18 +39,21 @@ function o(t, o, s) {
|
|
|
38
39
|
return p(e, n, t), n;
|
|
39
40
|
}, h = r(t()), g = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap();
|
|
40
41
|
function v(e) {
|
|
41
|
-
let t = (0, i.c)(
|
|
42
|
+
let t = (0, i.c)(12), r;
|
|
42
43
|
t[0] === e ? r = t[1] : (r = e === void 0 ? {} : e, t[0] = e, t[1] = r);
|
|
43
|
-
let a = r, o = n(h), s = a.skipMiddleware === !0, c = s ? _ : g;
|
|
44
|
-
|
|
44
|
+
let a = r, o = n(h), s = a.skipMiddleware === !0, c = s ? _ : g, l;
|
|
45
|
+
t[2] !== c || t[3] !== o ? (l = c.get(o), t[2] = c, t[3] = o, t[4] = l) : l = t[4];
|
|
46
|
+
let u = l;
|
|
47
|
+
if (u) return u;
|
|
48
|
+
let m;
|
|
49
|
+
if (t[5] !== c || t[6] !== o || t[7] !== s) {
|
|
45
50
|
let e;
|
|
46
|
-
t[
|
|
51
|
+
t[9] !== o || t[10] !== s ? (e = (e) => {
|
|
47
52
|
let t, n;
|
|
48
53
|
o((r) => (t = r, n = f(r, e), n)), !s && t !== void 0 && n !== void 0 && p(t, n, e);
|
|
49
|
-
}, t[
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return t[5] !== c || t[6] !== o ? (l = c.get(o), t[5] = c, t[6] = o, t[7] = l) : l = t[7], l;
|
|
54
|
+
}, t[9] = o, t[10] = s, t[11] = e) : e = t[11], m = d(e), c.set(o, m), t[5] = c, t[6] = o, t[7] = s, t[8] = m;
|
|
55
|
+
} else m = t[8];
|
|
56
|
+
return m;
|
|
53
57
|
}
|
|
54
58
|
return {
|
|
55
59
|
reducer: m,
|
|
@@ -2,7 +2,7 @@ import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
|
|
|
2
2
|
import { t } from "./react-sHtZdjeP.js";
|
|
3
3
|
import { t as n } from "./react-dom-DUmH0GXv.js";
|
|
4
4
|
import { c as r, l as i, u as a } from "./data-grid-types-0PJ-9N5n.js";
|
|
5
|
-
import { a as o, i as s, n as c, r as l } from "./glide-data-editor-
|
|
5
|
+
import { a as o, i as s, n as c, r as l } from "./glide-data-editor-D30zzaiO.js";
|
|
6
6
|
//#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_27cffe7f1bc30287d59ac27db3240c5b/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/data-grid-overlay-editor-style.js
|
|
7
7
|
var u = /* @__PURE__ */ e(t(), 1), d = /* @__PURE__ */ e(n(), 1), f = /*#__PURE__*/ o("div")({
|
|
8
8
|
name: "DataGridOverlayEditorStyle",
|
|
@@ -12,7 +12,7 @@ import { n as _ } from "./toast-CkB5Jq9K.js";
|
|
|
12
12
|
import { _ as v, a as y, c as b, d as x, f as S, l as C, m as te, p as w, t as ne, v as re, w as T, x as E } from "./utils-DXkj82sK.js";
|
|
13
13
|
import { t as D } from "./invariant-DLmrl-hA.js";
|
|
14
14
|
import { t as ie } from "./objects-DCmMvZtn.js";
|
|
15
|
-
import { t as ae } from "./createReducer-
|
|
15
|
+
import { t as ae } from "./createReducer-C_syF8Td.js";
|
|
16
16
|
import { M as oe, N as se, V as ce, g as le } from "./dist-CYeqK4Xw.js";
|
|
17
17
|
import { t as ue } from "./purify.es-DMv5zIkJ.js";
|
|
18
18
|
import { a as de, i as fe, l as pe, m as me, u as he } from "./static-state-BldGd99T.js";
|
|
@@ -3,14 +3,14 @@ import { h as t, t as n } from "./button-0-RqY1DW.js";
|
|
|
3
3
|
import { t as r } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as i } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { t as a } from "./copy-icon-DD8bdw4L.js";
|
|
6
|
-
import { A as o, E as s, I as c, K as l, P as u, T as d, i as f, n as p, zt as m } from "./error-entries-
|
|
7
|
-
import { n as h, t as ee } from "./globals-
|
|
6
|
+
import { A as o, E as s, I as c, K as l, P as u, T as d, i as f, n as p, zt as m } from "./error-entries-DFhMo601.js";
|
|
7
|
+
import { n as h, t as ee } from "./globals-BA0s7TxM.js";
|
|
8
8
|
import { t as g } from "./strings-BYJNyKmg.js";
|
|
9
9
|
import { t as _ } from "./jsx-runtime-3BD1kT0s.js";
|
|
10
10
|
import { l as te, r as v, x as ne } from "./utils-DXkj82sK.js";
|
|
11
11
|
import { a as re, i as ie, n as ae, r as oe } from "./dialog-BHYPX87J.js";
|
|
12
12
|
import { t as se } from "./useAsyncData-DsZMvNXn.js";
|
|
13
|
-
import { t as ce } from "./code-visibility-
|
|
13
|
+
import { t as ce } from "./code-visibility-TqQbHmZ5.js";
|
|
14
14
|
//#region src/components/ui/skeleton.tsx
|
|
15
15
|
var y = /* @__PURE__ */ e(r(), 1), b = i(), x = _(), le = (e) => {
|
|
16
16
|
let n = (0, b.c)(8), r, i;
|
|
@@ -6,7 +6,7 @@ import { i as s, n as c, r as l } from "./copy-icon-DD8bdw4L.js";
|
|
|
6
6
|
import { c as u, d, i as f, n as p, s as m, t as h } from "./select-CcidPqlM.js";
|
|
7
7
|
import { d as g, h as _, i as v, l as y, n as b, o as x, q as S, s as C, t as w, u as T } from "./dropdown-menu-Blu7V6Mk.js";
|
|
8
8
|
import { c as E, d as D, l as O, n as k, o as A, s as ee, t as j, u as te } from "./glide-utils-qbkRZpEy.js";
|
|
9
|
-
import { n as ne, t as re } from "./ErrorBoundary-
|
|
9
|
+
import { n as ne, t as re } from "./ErrorBoundary-m3vF1P4J.js";
|
|
10
10
|
import { i as ie, n as M } from "./strings-BYJNyKmg.js";
|
|
11
11
|
import { t as N } from "./react-dom-DUmH0GXv.js";
|
|
12
12
|
import { t as P } from "./jsx-runtime-3BD1kT0s.js";
|
|
@@ -7062,7 +7062,7 @@ function rs(e, t, n, r, i) {
|
|
|
7062
7062
|
}
|
|
7063
7063
|
//#endregion
|
|
7064
7064
|
//#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_27cffe7f1bc30287d59ac27db3240c5b/node_modules/@glideapps/glide-data-grid/dist/esm/data-editor/data-editor.js
|
|
7065
|
-
var is = /* @__PURE__ */ e(_r(), 1), as = /* @__PURE__ */ e(xr(), 1), os = K.lazy(async () => await import("./data-grid-overlay-editor-
|
|
7065
|
+
var is = /* @__PURE__ */ e(_r(), 1), as = /* @__PURE__ */ e(xr(), 1), os = K.lazy(async () => await import("./data-grid-overlay-editor-CLQPFjyJ.js")), ss = 0;
|
|
7066
7066
|
function cs(e) {
|
|
7067
7067
|
return (0, is.default)((0, as.default)((0, as.default)(e).filter((e) => e.span !== void 0).map((e) => (0, Za.default)((e.span?.[0] ?? 0) + 1, (e.span?.[1] ?? 0) + 1))));
|
|
7068
7068
|
}
|
|
@@ -9293,7 +9293,7 @@ function Vs(e, t, n, r, i) {
|
|
|
9293
9293
|
}
|
|
9294
9294
|
//#endregion
|
|
9295
9295
|
//#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_27cffe7f1bc30287d59ac27db3240c5b/node_modules/@glideapps/glide-data-grid/dist/esm/cells/number-cell.js
|
|
9296
|
-
var Hs = K.lazy(async () => await import("./number-overlay-editor-
|
|
9296
|
+
var Hs = K.lazy(async () => await import("./number-overlay-editor-B1nffNQ2.js")), Us = {
|
|
9297
9297
|
getAccessibilityString: (e) => e.data?.toString() ?? "",
|
|
9298
9298
|
kind: W.Number,
|
|
9299
9299
|
needsHover: (e) => e.hoverEffect === !0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { m as e } from "./tooltip-Bzl4k00l.js";
|
|
2
2
|
import { l as t } from "./utils-DXkj82sK.js";
|
|
3
|
-
import { r as n } from "./code-visibility-
|
|
3
|
+
import { r as n } from "./code-visibility-TqQbHmZ5.js";
|
|
4
4
|
var r = e("triangle-alert", [
|
|
5
5
|
["path", {
|
|
6
6
|
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
|
|
@@ -9,7 +9,7 @@ import { a as ne, i as re, o as D, r as O, s as k, t as ie } from "./useLifecycl
|
|
|
9
9
|
import { A as ae, M as oe, a as se, c as ce, i as le, n as ue, o as A, r as de, s as fe, t as pe } from "./select-CcidPqlM.js";
|
|
10
10
|
import { Y as me, mt as he, q as ge } from "./dropdown-menu-Blu7V6Mk.js";
|
|
11
11
|
import { c as _e, l as j, n as M } from "./config-mwEjAmvP.js";
|
|
12
|
-
import { C as ve, Ct as ye, D as be, Dt as xe, F as Se, Ft as N, G as Ce, I as we, L as Te, Lt as Ee, Mt as De, N as Oe, O as ke, S as Ae, T as je, Tt as Me, W as Ne, _ as Pe, _t as Fe, a as Ie, bt as Le, dt as Re, f as ze, ft as Be, gt as Ve, h as He, ht as Ue, it as We, mt as Ge, nt as Ke, o as qe, p as Je, pt as Ye, rt as Xe, s as Ze, ut as Qe, v as $e, vt as et, w as tt, x as nt, yt as rt } from "./error-entries-
|
|
12
|
+
import { C as ve, Ct as ye, D as be, Dt as xe, F as Se, Ft as N, G as Ce, I as we, L as Te, Lt as Ee, Mt as De, N as Oe, O as ke, S as Ae, T as je, Tt as Me, W as Ne, _ as Pe, _t as Fe, a as Ie, bt as Le, dt as Re, f as ze, ft as Be, gt as Ve, h as He, ht as Ue, it as We, mt as Ge, nt as Ke, o as qe, p as Je, pt as Ye, rt as Xe, s as Ze, ut as Qe, v as $e, vt as et, w as tt, x as nt, yt as rt } from "./error-entries-DFhMo601.js";
|
|
13
13
|
import { i as it, o as at } from "./strings-BYJNyKmg.js";
|
|
14
14
|
import { t as ot } from "./react-dom-DUmH0GXv.js";
|
|
15
15
|
import { t as st } from "./jsx-runtime-3BD1kT0s.js";
|
|
@@ -19,7 +19,7 @@ import { n as kt, o as At, s as jt, t as Mt } from "./useTheme-BZ2GGLgm.js";
|
|
|
19
19
|
import { D as Nt, S as P, _ as Pt, a as Ft, b as It, f as Lt, g as Rt, h as zt, l as F, w as I, x as Bt, y as Vt } from "./utils-DXkj82sK.js";
|
|
20
20
|
import { t as Ht } from "./invariant-DLmrl-hA.js";
|
|
21
21
|
import { t as Ut } from "./objects-DCmMvZtn.js";
|
|
22
|
-
import { t as Wt } from "./createReducer-
|
|
22
|
+
import { t as Wt } from "./createReducer-C_syF8Td.js";
|
|
23
23
|
import { Ct as Gt, Dt as Kt, Et as L, F as qt, H as Jt, I as Yt, Lt as Xt, Ot as Zt, Q as Qt, R as $t, S as en, St as tn, U as nn, V as R, W as rn, Wt as an, _t as on, a as z, b as sn, bt as cn, c as ln, dt as un, kt as dn, nt as fn, o as pn, ot as mn, pt as hn, rt as gn, ut as _n, v as vn, vt as yn, yt as bn, z as xn } from "./dist-CYeqK4Xw.js";
|
|
24
24
|
import { c as Sn, m as Cn, r as wn } from "./static-state-BldGd99T.js";
|
|
25
25
|
import { C as Tn, I as En, M as Dn, N as On, O as kn, R as An, S as jn } from "./schemas-CdscWNy_.js";
|
package/dist/main.js
CHANGED
|
@@ -3,20 +3,20 @@ import { _ as a, a as o, c as s, d as c, g as l, h as u, l as d, m as f, n as p,
|
|
|
3
3
|
import { t as y } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as b } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { i as x, n as S, r as C, t as w } from "./copy-icon-DD8bdw4L.js";
|
|
6
|
-
import { $ as T, A as E, At as D, B as O, Bt as k, Ct as A, Et as j, F as M, Ft as N, Gt as P, H as F, Ht as I, I as L, Jt as R, Lt as z, M as B, Mt as ee, Pt as te, R as ne, St as re, U as ie, Ut as ae, V as oe, Vt as se, W as ce, Wt as le, Z as ue, _ as de, a as fe, at as pe, b as me, c as he, et as ge, ht as _e, i as ve, jt as ye, kt as be, mt as xe, n as Se, nt as Ce, o as we, ot as Te, pt as Ee, qt as De, rt as Oe, tt as ke, v as Ae, vt as je, w as Me, wt as Ne, x as Pe, xt as Fe, y as Ie, z as Le, zt as Re } from "./html-to-image-
|
|
6
|
+
import { $ as T, A as E, At as D, B as O, Bt as k, Ct as A, Et as j, F as M, Ft as N, Gt as P, H as F, Ht as I, I as L, Jt as R, Lt as z, M as B, Mt as ee, Pt as te, R as ne, St as re, U as ie, Ut as ae, V as oe, Vt as se, W as ce, Wt as le, Z as ue, _ as de, a as fe, at as pe, b as me, c as he, et as ge, ht as _e, i as ve, jt as ye, kt as be, mt as xe, n as Se, nt as Ce, o as we, ot as Te, pt as Ee, qt as De, rt as Oe, tt as ke, v as Ae, vt as je, w as Me, wt as Ne, x as Pe, xt as Fe, y as Ie, z as Le, zt as Re } from "./html-to-image-BPs9Vo-H.js";
|
|
7
7
|
import { a as ze, d as Be, i as Ve, m as He, n as Ue, o as We, p as Ge, r as Ke, t as qe } from "./tooltip-Bzl4k00l.js";
|
|
8
8
|
import { D as Je, E as Ye, O as Xe, S as Ze, T as Qe, _ as $e, a as et, c as tt, d as nt, f as rt, g as it, h as at, i as ot, l as st, m as ct, n as lt, o as ut, p as dt, r as ft, s as pt, t as mt, u as ht, v as gt, w as _t, x as vt, y as yt } from "./spec-ZwfZcgsm.js";
|
|
9
|
-
import { $t as bt, A as xt, At as St, B as Ct, Bt as wt, C as Tt, Ct as Et, D as Dt, Dt as Ot, E as kt, Et as At, F as jt, Ft as Mt, G as Nt, Gt as Pt, H as Ft, Ht as It, I as Lt, It as Rt, J as zt, Jt as Bt, K as Vt, Kt as Ht, L as Ut, Lt as Wt, M as Gt, Mt as Kt, N as qt, Nt as Jt, O as Yt, Ot as Xt, P as Zt, Pt as Qt, Qt as $t, R as en, Rt as tn, S as nn, T as rn, Tt as an, U as on, Ut as sn, V as cn, Vt as ln, W as un, Wt as dn, X as fn, Xt as pn, Y as mn, Yt as hn, Z as gn, Zt as _n, _ as vn, _t as yn, an as bn, at as xn, b as Sn, bt as Cn, c as wn, cn as Tn, ct as En, d as Dn, dn as On, dt as kn, en as An, f as jn, fn as Mn, ft as Nn, g as Pn, gn as Fn, gt as In, h as Ln, hn as Rn, ht as zn, in as Bn, it as Vn, j as Hn, jt as Un, k as Wn, kt as Gn, ln as Kn, lt as qn, m as Jn, mn as Yn, mt as Xn, nn as Zn, nt as Qn, on as $n, ot as er, p as tr, pn as nr, pt as rr, q as ir, qt as ar, r as or, rn as sr, rt as cr, st as lr, t as ur, tn as dr, tt as fr, u as pr, un as mr, ut as hr, v as gr, vt as _r, w as vr, wt as yr, x as br, y as xr, yt as Sr, z as Cr, zt as wr } from "./common-
|
|
9
|
+
import { $t as bt, A as xt, At as St, B as Ct, Bt as wt, C as Tt, Ct as Et, D as Dt, Dt as Ot, E as kt, Et as At, F as jt, Ft as Mt, G as Nt, Gt as Pt, H as Ft, Ht as It, I as Lt, It as Rt, J as zt, Jt as Bt, K as Vt, Kt as Ht, L as Ut, Lt as Wt, M as Gt, Mt as Kt, N as qt, Nt as Jt, O as Yt, Ot as Xt, P as Zt, Pt as Qt, Qt as $t, R as en, Rt as tn, S as nn, T as rn, Tt as an, U as on, Ut as sn, V as cn, Vt as ln, W as un, Wt as dn, X as fn, Xt as pn, Y as mn, Yt as hn, Z as gn, Zt as _n, _ as vn, _t as yn, an as bn, at as xn, b as Sn, bt as Cn, c as wn, cn as Tn, ct as En, d as Dn, dn as On, dt as kn, en as An, f as jn, fn as Mn, ft as Nn, g as Pn, gn as Fn, gt as In, h as Ln, hn as Rn, ht as zn, in as Bn, it as Vn, j as Hn, jt as Un, k as Wn, kt as Gn, ln as Kn, lt as qn, m as Jn, mn as Yn, mt as Xn, nn as Zn, nt as Qn, on as $n, ot as er, p as tr, pn as nr, pt as rr, q as ir, qt as ar, r as or, rn as sr, rt as cr, st as lr, t as ur, tn as dr, tt as fr, u as pr, un as mr, ut as hr, v as gr, vt as _r, w as vr, wt as yr, x as br, y as xr, yt as Sr, z as Cr, zt as wr } from "./common-BY_oazL9.js";
|
|
10
10
|
import { a as Tr, n as Er, s as Dr, t as Or } from "./useLifecycle-GNgvNwI-.js";
|
|
11
11
|
import { t as kr } from "./check-CSvxZk5I.js";
|
|
12
12
|
import { A as Ar, C as jr, D as Mr, M as Nr, O as Pr, a as Fr, c as Ir, d as Lr, i as Rr, k as zr, l as Br, n as Vr, o as Hr, r as Ur, s as Wr, t as Gr, w as Kr, x as qr } from "./select-CcidPqlM.js";
|
|
13
13
|
import { B as Jr, C as Yr, J as Xr, Mt as Zr, Q as Qr, S as $r, W as ei, X as ti, Y as ni, Z as ri, _ as ii, _t as ai, a as oi, bn as si, c as ci, f as li, g as ui, h as di, i as fi, kt as pi, m as mi, n as hi, nt as gi, p as _i, pt as vi, r as yi, s as bi, t as xi, v as Si, w as Ci, xn as wi, y as Ti, z as Ei } from "./dropdown-menu-Blu7V6Mk.js";
|
|
14
14
|
import { c as Di, i as Oi, l as ki, o as Ai, s as ji, t as Mi } from "./config-mwEjAmvP.js";
|
|
15
|
-
import { A as Ni, At as Pi, B as Fi, G as Ii, It as Li, J as Ri, K as zi, N as Bi, Nt as Vi, Ot as Hi, Pt as Ui, R as Wi, St as Gi, T as Ki, Tt as qi, V as Ji, X as Yi, Y as Xi, Z as Zi, _ as Qi, at as $i, c as ea, ct as ta, d as na, g as ra, h as ia, jt as aa, k as oa, kt as sa, lt as ca, m as la, ot as ua, p as da, q as fa, s as pa, ut as ma, xt as ha, z as ga } from "./error-entries-
|
|
16
|
-
import { a as _a, c as va, d as ya, f as ba, i as xa, l as Sa, n as Ca, o as wa, r as Ta, s as Ea, t as Da } from "./process-output-
|
|
15
|
+
import { A as Ni, At as Pi, B as Fi, G as Ii, It as Li, J as Ri, K as zi, N as Bi, Nt as Vi, Ot as Hi, Pt as Ui, R as Wi, St as Gi, T as Ki, Tt as qi, V as Ji, X as Yi, Y as Xi, Z as Zi, _ as Qi, at as $i, c as ea, ct as ta, d as na, g as ra, h as ia, jt as aa, k as oa, kt as sa, lt as ca, m as la, ot as ua, p as da, q as fa, s as pa, ut as ma, xt as ha, z as ga } from "./error-entries-DFhMo601.js";
|
|
16
|
+
import { a as _a, c as va, d as ya, f as ba, i as xa, l as Sa, n as Ca, o as wa, r as Ta, s as Ea, t as Da } from "./process-output-c6xaHokq.js";
|
|
17
17
|
import { a as Oa, c as ka, d as Aa, i as ja, l as Ma, r as Na, u as Pa } from "./glide-utils-qbkRZpEy.js";
|
|
18
|
-
import { n as Fa, t as Ia } from "./ErrorBoundary-
|
|
19
|
-
import { n as La, t as Ra } from "./globals-
|
|
18
|
+
import { n as Fa, t as Ia } from "./ErrorBoundary-m3vF1P4J.js";
|
|
19
|
+
import { n as La, t as Ra } from "./globals-BA0s7TxM.js";
|
|
20
20
|
import { a as za, i as Ba, n as Va, r as Ha, s as Ua, t as Wa } from "./strings-BYJNyKmg.js";
|
|
21
21
|
import { t as Ga } from "./react-dom-DUmH0GXv.js";
|
|
22
22
|
import { t as Ka } from "./jsx-runtime-3BD1kT0s.js";
|
|
@@ -29,7 +29,7 @@ import { c as ho, d as go, n as _o, o as vo, p as yo } from "./useTheme-BZ2GGLgm
|
|
|
29
29
|
import { D as bo, _ as xo, b as So, f as Co, h as wo, i as To, l as Eo, m as Do, n as Oo, t as ko, w as Ao, x as jo, y as Mo } from "./utils-DXkj82sK.js";
|
|
30
30
|
import { t as No } from "./invariant-DLmrl-hA.js";
|
|
31
31
|
import { t as Po } from "./objects-DCmMvZtn.js";
|
|
32
|
-
import { t as Fo } from "./createReducer-
|
|
32
|
+
import { t as Fo } from "./createReducer-C_syF8Td.js";
|
|
33
33
|
import { R as V, V as Io, f as Lo, j as Ro, t as zo } from "./dist-CYeqK4Xw.js";
|
|
34
34
|
import { c as Bo, i as Vo, m as Ho, n as Uo, o as Wo, r as Go, t as Ko } from "./static-state-BldGd99T.js";
|
|
35
35
|
import { i as qo, n as Jo, r as Yo } from "./formats-gGospKWJ.js";
|
|
@@ -44,7 +44,7 @@ import { t as Hs } from "./useAsyncData-DsZMvNXn.js";
|
|
|
44
44
|
import { t as Us } from "./semaphore-89jsoHtS.js";
|
|
45
45
|
import { D as Ws, O as Gs } from "./vega-loader.browser-B9Pz0EGP.js";
|
|
46
46
|
import { a as Ks, n as qs } from "./loader-BVEtQ4F3.js";
|
|
47
|
-
import { c as Js, d as Ys, i as Xs, l as Zs, o as Qs, s as $s, t as ec, u as tc } from "./code-visibility-
|
|
47
|
+
import { c as Js, d as Ys, i as Xs, l as Zs, o as Qs, s as $s, t as ec, u as tc } from "./code-visibility-TqQbHmZ5.js";
|
|
48
48
|
import { t as nc } from "./useDeepCompareMemoize-KMBBux8C.js";
|
|
49
49
|
import { t as rc } from "./esm-BgKjMvWw.js";
|
|
50
50
|
//#region ../node_modules/.pnpm/iconify-icon@2.3.0/node_modules/iconify-icon/dist/iconify-icon.mjs
|
|
@@ -11940,7 +11940,7 @@ var pE = (e) => {
|
|
|
11940
11940
|
output: t
|
|
11941
11941
|
};
|
|
11942
11942
|
} };
|
|
11943
|
-
} }, yE = J.lazy(() => import("./chat-ui-
|
|
11943
|
+
} }, yE = J.lazy(() => import("./chat-ui-Bl_I-evE.js").then((e) => ({ default: e.Chatbot }))), bE = K(G({
|
|
11944
11944
|
id: U(),
|
|
11945
11945
|
role: q([
|
|
11946
11946
|
"system",
|
|
@@ -12406,7 +12406,7 @@ function _D(e, t) {
|
|
|
12406
12406
|
}
|
|
12407
12407
|
//#endregion
|
|
12408
12408
|
//#region src/plugins/impl/DataEditorPlugin.tsx
|
|
12409
|
-
var vD = J.lazy(() => import("./glide-data-editor-
|
|
12409
|
+
var vD = J.lazy(() => import("./glide-data-editor-D30zzaiO.js").then((e) => e.t)), yD = eE("marimo-data-editor", { cssStyles: [CE] }).withData(G({
|
|
12410
12410
|
initialValue: G({ edits: K(G({
|
|
12411
12411
|
rowIdx: W(),
|
|
12412
12412
|
columnId: U(),
|
|
@@ -17558,7 +17558,7 @@ function KA(e) {
|
|
|
17558
17558
|
}
|
|
17559
17559
|
//#endregion
|
|
17560
17560
|
//#region src/plugins/impl/data-explorer/DataExplorerPlugin.tsx
|
|
17561
|
-
var qA = J.lazy(() => import("./ConnectedDataExplorerComponent-
|
|
17561
|
+
var qA = J.lazy(() => import("./ConnectedDataExplorerComponent-DjlwdMQT.js")), JA = eE("marimo-data-explorer").withData(G({
|
|
17562
17562
|
label: U().nullish(),
|
|
17563
17563
|
data: U()
|
|
17564
17564
|
})).renderer((e) => /* @__PURE__ */ (0, Y.jsx)(qA, {
|
|
@@ -32194,7 +32194,7 @@ function vH(e) {
|
|
|
32194
32194
|
}
|
|
32195
32195
|
//#endregion
|
|
32196
32196
|
//#region src/components/editor/renderers/slides-layout/slides-layout.tsx
|
|
32197
|
-
var yH = J.lazy(() => import("./reveal-component-
|
|
32197
|
+
var yH = J.lazy(() => import("./reveal-component-fg3-aYjk.js")), bH = (e) => {
|
|
32198
32198
|
let t = (0, X.c)(33), { layout: n, setLayout: r, cells: i, mode: a } = e, o = jo(Wo), s = a === "read" || o, c = jo(ha) > 1, [l, u] = (0, J.useState)(null), d;
|
|
32199
32199
|
t[0] !== i || t[1] !== n ? (d = gR(i, n), t[0] = i, t[1] = n, t[2] = d) : d = t[2];
|
|
32200
32200
|
let { slideCells: f, skippedIds: p, noOutputIds: m, slideTypes: h, startCellIndex: g } = d, _;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
|
|
2
2
|
import { t } from "./react-sHtZdjeP.js";
|
|
3
|
-
import { a as n } from "./glide-data-editor-
|
|
3
|
+
import { a as n } from "./glide-data-editor-D30zzaiO.js";
|
|
4
4
|
//#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_27cffe7f1bc30287d59ac27db3240c5b/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/private/number-overlay-editor-style.js
|
|
5
5
|
var r = /* @__PURE__ */ e(t()), i = /*#__PURE__*/ n("div")({
|
|
6
6
|
name: "NumberOverlayEditorStyle",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { k as e } from "./html-to-image-
|
|
1
|
+
import { k as e } from "./html-to-image-BPs9Vo-H.js";
|
|
2
2
|
import { m as t } from "./tooltip-Bzl4k00l.js";
|
|
3
|
-
import { $ as n, et as r } from "./error-entries-
|
|
3
|
+
import { $ as n, et as r } from "./error-entries-DFhMo601.js";
|
|
4
4
|
import { t as i } from "./strings-BYJNyKmg.js";
|
|
5
5
|
import { n as a } from "./semaphore-89jsoHtS.js";
|
|
6
6
|
var o = t("file", [["path", {
|
|
@@ -3,15 +3,15 @@ import { c as t, g as n, h as r, m as i, t as a } from "./button-0-RqY1DW.js";
|
|
|
3
3
|
import { t as o } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as s } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { m as c, t as l } from "./tooltip-Bzl4k00l.js";
|
|
6
|
-
import { $ as u, Q as d, et as f, i as p, l as m, n as h, on as g, r as _, sn as v, t as y, u as b, un as x } from "./common-
|
|
6
|
+
import { $ as u, Q as d, et as f, i as p, l as m, n as h, on as g, r as _, sn as v, t as y, u as b, un as x } from "./common-BY_oazL9.js";
|
|
7
7
|
import { M as S } from "./select-CcidPqlM.js";
|
|
8
8
|
import { Y as ee } from "./dropdown-menu-Blu7V6Mk.js";
|
|
9
|
-
import { Pt as C } from "./error-entries-
|
|
9
|
+
import { Pt as C } from "./error-entries-DFhMo601.js";
|
|
10
10
|
import { t as w } from "./jsx-runtime-3BD1kT0s.js";
|
|
11
11
|
import { r as T } from "./use-restore-focus-CmflVLWJ.js";
|
|
12
12
|
import { D as E, t as D, x as O } from "./utils-DXkj82sK.js";
|
|
13
13
|
import { o as k } from "./static-state-BldGd99T.js";
|
|
14
|
-
import { a as A, n as te, t as ne } from "./code-visibility-
|
|
14
|
+
import { a as A, n as te, t as ne } from "./code-visibility-TqQbHmZ5.js";
|
|
15
15
|
/* empty css */
|
|
16
16
|
var j = c("sticky-note", [["path", {
|
|
17
17
|
d: "M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",
|
package/package.json
CHANGED
|
@@ -39,8 +39,7 @@ export interface ColumnFormattingInstance {
|
|
|
39
39
|
setColumnFormatting: (value?: FormatOption) => void;
|
|
40
40
|
getColumnFormatting?: () => FormatOption | undefined;
|
|
41
41
|
getCanFormat?: () => boolean;
|
|
42
|
-
|
|
43
|
-
applyColumnFormatting: (value: any) => any;
|
|
42
|
+
applyColumnFormatting: (value: unknown) => unknown;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
// Use declaration merging to add APIs and state types
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
import { renderHook } from "@testing-library/react";
|
|
3
|
-
import { createStore, Provider } from "jotai";
|
|
2
|
+
import { act, renderHook } from "@testing-library/react";
|
|
3
|
+
import { createStore, getDefaultStore, Provider } from "jotai";
|
|
4
4
|
import type { PropsWithChildren } from "react";
|
|
5
|
-
import { describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { describe, expect, expectTypeOf, it, vi } from "vitest";
|
|
6
6
|
import { Logger } from "@/utils/Logger";
|
|
7
7
|
import { createReducer, createReducerAndAtoms } from "../createReducer";
|
|
8
8
|
|
|
@@ -38,6 +38,68 @@ describe("createReducer", () => {
|
|
|
38
38
|
expect(dispatch).toHaveBeenCalledWith({ type: "decrement", payload: 3 });
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
it("preserves action names and payload types through reducers and atoms", () => {
|
|
42
|
+
const initialState = () => ({ count: 0 });
|
|
43
|
+
const { reducer, createActions, useActions } = createReducerAndAtoms(
|
|
44
|
+
initialState,
|
|
45
|
+
{
|
|
46
|
+
increment: (state, payload: number) => ({
|
|
47
|
+
count: state.count + payload,
|
|
48
|
+
}),
|
|
49
|
+
setFromText: (_state, payload: string) => ({ count: payload.length }),
|
|
50
|
+
reset: () => initialState(),
|
|
51
|
+
},
|
|
52
|
+
[
|
|
53
|
+
(_prevState, _newState, action) => {
|
|
54
|
+
if (action.type === "increment") {
|
|
55
|
+
expectTypeOf(action.payload).toEqualTypeOf<number>();
|
|
56
|
+
}
|
|
57
|
+
if (action.type === "setFromText") {
|
|
58
|
+
expectTypeOf(action.payload).toEqualTypeOf<string>();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
);
|
|
63
|
+
const dispatch = vi.fn();
|
|
64
|
+
const actions = createActions(dispatch);
|
|
65
|
+
|
|
66
|
+
expectTypeOf(actions).toEqualTypeOf<{
|
|
67
|
+
increment: (payload: number) => void;
|
|
68
|
+
setFromText: (payload: string) => void;
|
|
69
|
+
reset: () => void;
|
|
70
|
+
}>();
|
|
71
|
+
expectTypeOf<ReturnType<typeof useActions>>().toEqualTypeOf<
|
|
72
|
+
typeof actions
|
|
73
|
+
>();
|
|
74
|
+
expectTypeOf(reducer)
|
|
75
|
+
.parameter(1)
|
|
76
|
+
.toEqualTypeOf<
|
|
77
|
+
| { type: "increment"; payload: number }
|
|
78
|
+
| { type: "setFromText"; payload: string }
|
|
79
|
+
| { type: "reset"; payload: unknown }
|
|
80
|
+
>();
|
|
81
|
+
|
|
82
|
+
// @ts-expect-error - action names determine their payload types
|
|
83
|
+
expectTypeOf(reducer).toBeCallableWith(initialState(), {
|
|
84
|
+
type: "increment",
|
|
85
|
+
payload: "5",
|
|
86
|
+
});
|
|
87
|
+
// @ts-expect-error - action creators reject incorrect payloads
|
|
88
|
+
expectTypeOf(actions.setFromText).toBeCallableWith(5);
|
|
89
|
+
|
|
90
|
+
actions.increment(5);
|
|
91
|
+
actions.setFromText("hello");
|
|
92
|
+
actions.reset();
|
|
93
|
+
expect(dispatch.mock.calls).toEqual([
|
|
94
|
+
[{ type: "increment", payload: 5 }],
|
|
95
|
+
[{ type: "setFromText", payload: "hello" }],
|
|
96
|
+
[{ type: "reset", payload: undefined }],
|
|
97
|
+
]);
|
|
98
|
+
expect(
|
|
99
|
+
reducer(initialState(), { type: "setFromText", payload: "hello" }),
|
|
100
|
+
).toEqual({ count: 5 });
|
|
101
|
+
});
|
|
102
|
+
|
|
41
103
|
it("actions are the same reference", () => {
|
|
42
104
|
const initialState = () => ({ count: 0 });
|
|
43
105
|
const reducers = {
|
|
@@ -123,6 +185,41 @@ describe("createReducerAndAtoms", () => {
|
|
|
123
185
|
expect(typeof result.useActions).toBe("function");
|
|
124
186
|
});
|
|
125
187
|
|
|
188
|
+
it("caches hook actions and supports bypassing middleware", () => {
|
|
189
|
+
const middleware = vi.fn();
|
|
190
|
+
const { useActions, valueAtom } = createReducerAndAtoms(
|
|
191
|
+
() => ({ count: 0 }),
|
|
192
|
+
{
|
|
193
|
+
increment: (state, payload: number) => ({
|
|
194
|
+
count: state.count + payload,
|
|
195
|
+
}),
|
|
196
|
+
},
|
|
197
|
+
[middleware],
|
|
198
|
+
);
|
|
199
|
+
const { result, rerender } = renderHook((options) => useActions(options), {
|
|
200
|
+
initialProps: { skipMiddleware: false },
|
|
201
|
+
});
|
|
202
|
+
const actions = result.current;
|
|
203
|
+
act(() => actions.increment(2));
|
|
204
|
+
rerender({ skipMiddleware: false });
|
|
205
|
+
expect(result.current).toBe(actions);
|
|
206
|
+
expect(getDefaultStore().get(valueAtom)).toEqual({ count: 2 });
|
|
207
|
+
expect(middleware).toHaveBeenCalledExactlyOnceWith(
|
|
208
|
+
{ count: 0 },
|
|
209
|
+
{ count: 2 },
|
|
210
|
+
{ type: "increment", payload: 2 },
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
middleware.mockClear();
|
|
214
|
+
rerender({ skipMiddleware: true });
|
|
215
|
+
const plainActions = result.current;
|
|
216
|
+
rerender({ skipMiddleware: true });
|
|
217
|
+
expect(result.current).toBe(plainActions);
|
|
218
|
+
act(() => result.current.increment(3));
|
|
219
|
+
expect(getDefaultStore().get(valueAtom)).toEqual({ count: 5 });
|
|
220
|
+
expect(middleware).not.toHaveBeenCalled();
|
|
221
|
+
});
|
|
222
|
+
|
|
126
223
|
it("should apply middleware", () => {
|
|
127
224
|
const initialState = () => ({ count: 0 });
|
|
128
225
|
const reducers = {
|
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
/* oxlint-disable typescript/no-explicit-any */
|
|
3
2
|
|
|
4
3
|
import { atom, useSetAtom } from "jotai";
|
|
5
4
|
import type { Reducer } from "react";
|
|
6
5
|
import { Logger } from "@/utils/Logger";
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type IfUnknown<T, Y, N> = unknown extends T ? Y : N;
|
|
7
|
+
type ReducerHandlers<State, Payloads> = {
|
|
8
|
+
[Type in keyof Payloads]: (state: State, payload: Payloads[Type]) => State;
|
|
9
|
+
};
|
|
12
10
|
|
|
13
|
-
type
|
|
11
|
+
type ReducerConstraints<State> = Record<
|
|
12
|
+
string,
|
|
13
|
+
(state: State, payload: never) => State
|
|
14
|
+
>;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
[k: string]: ReducerHandler<State, any>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type ReducerActions<RH> = {
|
|
16
|
+
type PayloadsOf<RH> = {
|
|
20
17
|
[Type in keyof RH]: RH[Type] extends (
|
|
21
18
|
state: never,
|
|
22
19
|
payload: infer Payload,
|
|
23
20
|
) => unknown
|
|
24
|
-
?
|
|
21
|
+
? Payload
|
|
25
22
|
: never;
|
|
26
23
|
};
|
|
27
24
|
|
|
25
|
+
type Dispatch<Payloads> = (action: ReducerActionOf<Payloads>) => void;
|
|
26
|
+
|
|
27
|
+
type ReducerActions<Payloads> = {
|
|
28
|
+
[Type in keyof Payloads]: unknown extends Payloads[Type]
|
|
29
|
+
? () => void
|
|
30
|
+
: (payload: Payloads[Type]) => void;
|
|
31
|
+
};
|
|
32
|
+
|
|
28
33
|
/** Helper for typing middleware that receives dispatched actions. */
|
|
29
34
|
export type DispatchedActionOf<T> = {
|
|
30
35
|
[Key in keyof T]: T[Key] extends (payload: infer P) => unknown
|
|
@@ -32,27 +37,16 @@ export type DispatchedActionOf<T> = {
|
|
|
32
37
|
: never;
|
|
33
38
|
}[keyof T & string];
|
|
34
39
|
|
|
35
|
-
type ReducerActionOf<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
: never;
|
|
42
|
-
}[keyof RH & string];
|
|
40
|
+
type ReducerActionOf<
|
|
41
|
+
Payloads,
|
|
42
|
+
Key extends keyof Payloads & string = keyof Payloads & string,
|
|
43
|
+
> = {
|
|
44
|
+
[Type in Key]: { type: Type; payload: Payloads[Type] };
|
|
45
|
+
}[Key];
|
|
43
46
|
|
|
44
|
-
export interface ReducerCreatorResult<
|
|
45
|
-
State,
|
|
46
|
-
|
|
47
|
-
> {
|
|
48
|
-
/**
|
|
49
|
-
* The reducer function.
|
|
50
|
-
*/
|
|
51
|
-
reducer: Reducer<State, ReducerActionOf<RH>>;
|
|
52
|
-
/**
|
|
53
|
-
* Given a dispatch function, returns an object containing all the actions.
|
|
54
|
-
*/
|
|
55
|
-
createActions: (dispatch: Dispatch<RH>) => ReducerActions<RH>;
|
|
47
|
+
export interface ReducerCreatorResult<State, Payloads> {
|
|
48
|
+
reducer: Reducer<State, ReducerActionOf<Payloads>>;
|
|
49
|
+
createActions: (dispatch: Dispatch<Payloads>) => ReducerActions<Payloads>;
|
|
56
50
|
}
|
|
57
51
|
|
|
58
52
|
/**
|
|
@@ -60,51 +54,64 @@ export interface ReducerCreatorResult<
|
|
|
60
54
|
*/
|
|
61
55
|
export function createReducer<
|
|
62
56
|
State,
|
|
63
|
-
RH extends
|
|
64
|
-
>(
|
|
57
|
+
RH extends ReducerConstraints<NoInfer<State>>,
|
|
58
|
+
>(
|
|
59
|
+
initialState: () => State,
|
|
60
|
+
reducers: RH & ReducerHandlers<NoInfer<State>, PayloadsOf<RH>>,
|
|
61
|
+
): ReducerCreatorResult<State, PayloadsOf<RH>> {
|
|
62
|
+
type Payloads = PayloadsOf<RH>;
|
|
63
|
+
const handlers: ReducerHandlers<State, Payloads> = reducers;
|
|
65
64
|
return {
|
|
66
|
-
reducer: (state, action
|
|
65
|
+
reducer: (state, action) => {
|
|
67
66
|
state = state || initialState();
|
|
68
|
-
if (action.type in
|
|
69
|
-
return
|
|
67
|
+
if (action.type in handlers) {
|
|
68
|
+
return handlers[action.type](state, action.payload);
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
Logger.error(`Action type ${action.type} is not defined in reducers.`);
|
|
73
72
|
return state;
|
|
74
73
|
},
|
|
75
|
-
createActions: (dispatch
|
|
76
|
-
const actions
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
74
|
+
createActions: (dispatch) => {
|
|
75
|
+
const actions: {
|
|
76
|
+
[Key in keyof Payloads]?: (payload: Payloads[Key]) => void;
|
|
77
|
+
} = {};
|
|
78
|
+
const addAction = <Key extends keyof Payloads & string>(type: Key) => {
|
|
79
|
+
actions[type] = (payload) => dispatch({ type, payload });
|
|
80
|
+
};
|
|
81
|
+
for (const type in handlers) {
|
|
82
|
+
addAction(type);
|
|
81
83
|
}
|
|
82
|
-
|
|
84
|
+
// The loop fills every key; payload-free creators receive undefined.
|
|
85
|
+
return actions as ReducerActions<Payloads>;
|
|
83
86
|
},
|
|
84
87
|
};
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
type Middleware<State,
|
|
90
|
+
type Middleware<State, Payloads> = (
|
|
88
91
|
prevState: State,
|
|
89
92
|
newState: State,
|
|
90
|
-
action: ReducerActionOf<
|
|
93
|
+
action: ReducerActionOf<Payloads>,
|
|
91
94
|
) => void;
|
|
92
95
|
|
|
93
96
|
export function createReducerAndAtoms<
|
|
94
97
|
State,
|
|
95
|
-
RH extends
|
|
98
|
+
RH extends ReducerConstraints<NoInfer<State>>,
|
|
96
99
|
>(
|
|
97
100
|
initialState: () => State,
|
|
98
|
-
reducers: RH
|
|
99
|
-
middleware?: Middleware<State,
|
|
101
|
+
reducers: RH & ReducerHandlers<NoInfer<State>, PayloadsOf<RH>>,
|
|
102
|
+
middleware?: NoInfer<Middleware<State, PayloadsOf<RH>>[]>,
|
|
100
103
|
) {
|
|
104
|
+
type Payloads = PayloadsOf<RH>;
|
|
101
105
|
const allMiddleware = [...(middleware ?? [])];
|
|
102
|
-
const addMiddleware = (mw: Middleware<State,
|
|
106
|
+
const addMiddleware = (mw: Middleware<State, Payloads>) => {
|
|
103
107
|
allMiddleware.push(mw);
|
|
104
108
|
};
|
|
105
|
-
const { reducer, createActions } = createReducer
|
|
109
|
+
const { reducer, createActions } = createReducer<State, RH>(
|
|
110
|
+
initialState,
|
|
111
|
+
reducers,
|
|
112
|
+
);
|
|
106
113
|
|
|
107
|
-
const reduceSafely = (state: State, action: ReducerActionOf<
|
|
114
|
+
const reduceSafely = (state: State, action: ReducerActionOf<Payloads>) => {
|
|
108
115
|
try {
|
|
109
116
|
return reducer(state, action);
|
|
110
117
|
} catch (error) {
|
|
@@ -116,7 +123,7 @@ export function createReducerAndAtoms<
|
|
|
116
123
|
const runMiddleware = (
|
|
117
124
|
prev: State,
|
|
118
125
|
next: State,
|
|
119
|
-
action: ReducerActionOf<
|
|
126
|
+
action: ReducerActionOf<Payloads>,
|
|
120
127
|
) => {
|
|
121
128
|
for (const mw of allMiddleware) {
|
|
122
129
|
try {
|
|
@@ -127,47 +134,49 @@ export function createReducerAndAtoms<
|
|
|
127
134
|
}
|
|
128
135
|
};
|
|
129
136
|
|
|
130
|
-
const reducerWithMiddleware = (
|
|
137
|
+
const reducerWithMiddleware = (
|
|
138
|
+
state: State,
|
|
139
|
+
action: ReducerActionOf<Payloads>,
|
|
140
|
+
) => {
|
|
131
141
|
const next = reduceSafely(state, action);
|
|
132
142
|
runMiddleware(state, next, action);
|
|
133
143
|
return next;
|
|
134
144
|
};
|
|
135
145
|
|
|
136
146
|
const valueAtom = atom(initialState());
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
147
|
+
type ActionsCache = WeakMap<
|
|
148
|
+
ReturnType<typeof useSetAtom<typeof valueAtom>>,
|
|
149
|
+
ReducerActions<Payloads>
|
|
150
|
+
>;
|
|
151
|
+
const actionsMap: ActionsCache = new WeakMap();
|
|
152
|
+
const plainActionsMap: ActionsCache = new WeakMap();
|
|
140
153
|
|
|
141
154
|
function useActions(
|
|
142
155
|
options: { skipMiddleware?: boolean } = {},
|
|
143
|
-
): ReducerActions<
|
|
156
|
+
): ReducerActions<Payloads> {
|
|
144
157
|
const setState = useSetAtom(valueAtom);
|
|
145
158
|
const skipMiddleware = options.skipMiddleware === true;
|
|
146
159
|
const cache = skipMiddleware ? plainActionsMap : actionsMap;
|
|
147
160
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
createActions((action: ReducerActionOf<RH>) => {
|
|
152
|
-
// Reduce inside the write. Middleware runs once the write has
|
|
153
|
-
// committed and its subscribers have run, so anything it sets in
|
|
154
|
-
// turn observes the new state rather than the one being replaced.
|
|
155
|
-
let prev: State | undefined;
|
|
156
|
-
let next: State | undefined;
|
|
157
|
-
setState((state: State) => {
|
|
158
|
-
prev = state;
|
|
159
|
-
next = reduceSafely(state, action);
|
|
160
|
-
return next;
|
|
161
|
-
});
|
|
162
|
-
if (!skipMiddleware && prev !== undefined && next !== undefined) {
|
|
163
|
-
runMiddleware(prev, next, action);
|
|
164
|
-
}
|
|
165
|
-
}),
|
|
166
|
-
);
|
|
161
|
+
const cachedActions = cache.get(setState);
|
|
162
|
+
if (cachedActions) {
|
|
163
|
+
return cachedActions;
|
|
167
164
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
const actions = createActions((action) => {
|
|
166
|
+
// Middleware runs after the write commits so it observes the new state.
|
|
167
|
+
let prev: State | undefined;
|
|
168
|
+
let next: State | undefined;
|
|
169
|
+
setState((state: State) => {
|
|
170
|
+
prev = state;
|
|
171
|
+
next = reduceSafely(state, action);
|
|
172
|
+
return next;
|
|
173
|
+
});
|
|
174
|
+
if (!skipMiddleware && prev !== undefined && next !== undefined) {
|
|
175
|
+
runMiddleware(prev, next, action);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
cache.set(setState, actions);
|
|
179
|
+
return actions;
|
|
171
180
|
}
|
|
172
181
|
|
|
173
182
|
return {
|