@marimo-team/islands 0.19.10-dev49 → 0.19.10-dev51
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/main.js
CHANGED
|
@@ -64533,41 +64533,41 @@ ${O}`,
|
|
|
64533
64533
|
}
|
|
64534
64534
|
const AnyWidgetPlugin = createPlugin("marimo-anywidget").withData(object$1({
|
|
64535
64535
|
jsUrl: string$2(),
|
|
64536
|
-
jsHash: string$2()
|
|
64537
|
-
css: string$2().nullish()
|
|
64536
|
+
jsHash: string$2()
|
|
64538
64537
|
})).withFunctions({}).renderer((e) => (0, import_jsx_runtime.jsx)(AnyWidgetSlot, {
|
|
64539
64538
|
...e
|
|
64540
64539
|
}));
|
|
64541
64540
|
var AnyWidgetSlot = (e) => {
|
|
64542
64541
|
var _a2;
|
|
64543
|
-
let r = (0, import_compiler_runtime$98.c)(
|
|
64544
|
-
r[0] !==
|
|
64545
|
-
jsUrl:
|
|
64546
|
-
jsHash:
|
|
64547
|
-
}, r[0] =
|
|
64548
|
-
let { jsModule:
|
|
64549
|
-
if (
|
|
64542
|
+
let r = (0, import_compiler_runtime$98.c)(16), { jsUrl: c, jsHash: d } = e.data, { model_id: f } = e.value, _ = e.host, v;
|
|
64543
|
+
r[0] !== d || r[1] !== c ? (v = {
|
|
64544
|
+
jsUrl: c,
|
|
64545
|
+
jsHash: d
|
|
64546
|
+
}, r[0] = d, r[1] = c, r[2] = v) : v = r[2];
|
|
64547
|
+
let { jsModule: y, error: S } = useAnyWidgetModule(v);
|
|
64548
|
+
if (S) {
|
|
64550
64549
|
let e2;
|
|
64551
|
-
return r[3] ===
|
|
64552
|
-
error:
|
|
64553
|
-
}), r[3] =
|
|
64554
|
-
}
|
|
64555
|
-
if (!
|
|
64556
|
-
if (!isAnyWidgetModule(
|
|
64557
|
-
let e2 = `Module at ${
|
|
64558
|
-
r[5] === e2 ?
|
|
64559
|
-
let f2 =
|
|
64550
|
+
return r[3] === S ? e2 = r[4] : (e2 = (0, import_jsx_runtime.jsx)(ErrorBanner, {
|
|
64551
|
+
error: S
|
|
64552
|
+
}), r[3] = S, r[4] = e2), e2;
|
|
64553
|
+
}
|
|
64554
|
+
if (!y) return null;
|
|
64555
|
+
if (!isAnyWidgetModule(y)) {
|
|
64556
|
+
let e2 = `Module at ${c} does not appear to be a valid anywidget`, d2;
|
|
64557
|
+
r[5] === e2 ? d2 = r[6] : (d2 = Error(e2), r[5] = e2, r[6] = d2);
|
|
64558
|
+
let f2 = d2, _2;
|
|
64560
64559
|
return r[7] === f2 ? _2 = r[8] : (_2 = (0, import_jsx_runtime.jsx)(ErrorBanner, {
|
|
64561
64560
|
error: f2
|
|
64562
64561
|
}), r[7] = f2, r[8] = _2), _2;
|
|
64563
64562
|
}
|
|
64564
|
-
let
|
|
64565
|
-
r[9] === e.host ?
|
|
64566
|
-
let
|
|
64567
|
-
return r[11] !==
|
|
64568
|
-
widget:
|
|
64569
|
-
modelId:
|
|
64570
|
-
|
|
64563
|
+
let w;
|
|
64564
|
+
r[9] === e.host ? w = r[10] : (w = (_a2 = e.host.closest("[random-id]")) == null ? void 0 : _a2.getAttribute("random-id"), r[9] = e.host, r[10] = w);
|
|
64565
|
+
let E = w ?? c, O;
|
|
64566
|
+
return r[11] !== _ || r[12] !== y.default || r[13] !== E || r[14] !== f ? (O = (0, import_jsx_runtime.jsx)(LoadedSlot, {
|
|
64567
|
+
widget: y.default,
|
|
64568
|
+
modelId: f,
|
|
64569
|
+
host: _
|
|
64570
|
+
}, E), r[11] = _, r[12] = y.default, r[13] = E, r[14] = f, r[15] = O) : O = r[15], O;
|
|
64571
64571
|
};
|
|
64572
64572
|
async function runAnyWidgetModule(e, r, c, d, f) {
|
|
64573
64573
|
d.innerHTML = "";
|
|
@@ -64582,24 +64582,22 @@ ${O}`,
|
|
|
64582
64582
|
return e.default ? typeof e.default == "function" || typeof ((_a2 = e.default) == null ? void 0 : _a2.render) == "function" || typeof ((_b3 = e.default) == null ? void 0 : _b3.initialize) == "function" : false;
|
|
64583
64583
|
}
|
|
64584
64584
|
var LoadedSlot = (e) => {
|
|
64585
|
-
let r = (0, import_compiler_runtime$98.c)(
|
|
64586
|
-
r[0] === d ?
|
|
64587
|
-
let
|
|
64588
|
-
v ||
|
|
64589
|
-
|
|
64590
|
-
r[2] !== v || r[3] !== d || r[4] !== c ? (y = () => {
|
|
64591
|
-
if (!f.current || !v) return;
|
|
64585
|
+
let r = (0, import_compiler_runtime$98.c)(9), { widget: c, modelId: d, host: f } = e, _ = (0, import_react.useRef)(null), v, y;
|
|
64586
|
+
r[0] === d ? (v = r[1], y = r[2]) : (v = MODEL_MANAGER.getSync(d), v || Logger.error("Model not found for modelId", d), y = v == null ? void 0 : v.get("_css"), r[0] = d, r[1] = v, r[2] = y), useMountCss(y, f);
|
|
64587
|
+
let S, w;
|
|
64588
|
+
r[3] !== v || r[4] !== d || r[5] !== c ? (S = () => {
|
|
64589
|
+
if (!_.current || !v) return;
|
|
64592
64590
|
let e2 = new AbortController();
|
|
64593
|
-
return runAnyWidgetModule(c, v, d,
|
|
64594
|
-
},
|
|
64591
|
+
return runAnyWidgetModule(c, v, d, _.current, e2.signal), () => e2.abort();
|
|
64592
|
+
}, w = [
|
|
64595
64593
|
c,
|
|
64596
64594
|
d,
|
|
64597
64595
|
v
|
|
64598
|
-
], r[
|
|
64599
|
-
let
|
|
64600
|
-
return r[
|
|
64601
|
-
ref:
|
|
64602
|
-
}), r[
|
|
64596
|
+
], r[3] = v, r[4] = d, r[5] = c, r[6] = S, r[7] = w) : (S = r[6], w = r[7]), (0, import_react.useEffect)(S, w);
|
|
64597
|
+
let E;
|
|
64598
|
+
return r[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = (0, import_jsx_runtime.jsx)("div", {
|
|
64599
|
+
ref: _
|
|
64600
|
+
}), r[8] = E) : E = r[8], E;
|
|
64603
64601
|
}, import_compiler_runtime$97 = require_compiler_runtime();
|
|
64604
64602
|
const KeyboardHotkeys = (e) => {
|
|
64605
64603
|
let r = (0, import_compiler_runtime$97.c)(10), { shortcut: c, className: d } = e;
|
|
@@ -73309,7 +73307,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
|
|
|
73309
73307
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
73310
73308
|
}
|
|
73311
73309
|
}
|
|
73312
|
-
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.10-
|
|
73310
|
+
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.10-dev51"), showCodeInRunModeAtom = atom(true);
|
|
73313
73311
|
atom(null);
|
|
73314
73312
|
var import_compiler_runtime$88 = require_compiler_runtime();
|
|
73315
73313
|
function useKeydownOnElement(e, r) {
|
package/package.json
CHANGED
|
@@ -21,7 +21,6 @@ import { BINDING_MANAGER, WIDGET_DEF_REGISTRY } from "./widget-binding";
|
|
|
21
21
|
interface Data {
|
|
22
22
|
jsUrl: string;
|
|
23
23
|
jsHash: string;
|
|
24
|
-
css?: string | null;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
type AnyWidgetState = ModelState;
|
|
@@ -118,21 +117,18 @@ export const AnyWidgetPlugin = createPlugin<ModelIdRef>("marimo-anywidget")
|
|
|
118
117
|
z.object({
|
|
119
118
|
jsUrl: z.string(),
|
|
120
119
|
jsHash: z.string(),
|
|
121
|
-
css: z.string().nullish(),
|
|
122
120
|
}),
|
|
123
121
|
)
|
|
124
122
|
.withFunctions({})
|
|
125
123
|
.renderer((props) => <AnyWidgetSlot {...props} />);
|
|
126
124
|
|
|
127
125
|
const AnyWidgetSlot = (props: IPluginProps<ModelIdRef, Data>) => {
|
|
128
|
-
const {
|
|
126
|
+
const { jsUrl, jsHash } = props.data;
|
|
129
127
|
const { model_id: modelId } = props.value;
|
|
130
128
|
const host = props.host as HTMLElementNotDerivedFromRef;
|
|
131
129
|
|
|
132
130
|
const { jsModule, error } = useAnyWidgetModule({ jsUrl, jsHash });
|
|
133
131
|
|
|
134
|
-
useMountCss(css, host);
|
|
135
|
-
|
|
136
132
|
if (error) {
|
|
137
133
|
return <ErrorBanner error={error} />;
|
|
138
134
|
}
|
|
@@ -160,6 +156,7 @@ const AnyWidgetSlot = (props: IPluginProps<ModelIdRef, Data>) => {
|
|
|
160
156
|
key={key}
|
|
161
157
|
widget={jsModule.default}
|
|
162
158
|
modelId={modelId}
|
|
159
|
+
host={host}
|
|
163
160
|
/>
|
|
164
161
|
);
|
|
165
162
|
};
|
|
@@ -207,11 +204,13 @@ function isAnyWidgetModule(mod: any): mod is { default: AnyWidget } {
|
|
|
207
204
|
interface Props<T extends AnyWidgetState> {
|
|
208
205
|
widget: AnyWidget<T>;
|
|
209
206
|
modelId: WidgetModelId;
|
|
207
|
+
host: HTMLElementNotDerivedFromRef;
|
|
210
208
|
}
|
|
211
209
|
|
|
212
210
|
const LoadedSlot = <T extends AnyWidgetState>({
|
|
213
211
|
widget,
|
|
214
212
|
modelId,
|
|
213
|
+
host,
|
|
215
214
|
}: Props<T> & { widget: AnyWidget<T> }) => {
|
|
216
215
|
const htmlRef = useRef<HTMLDivElement>(null);
|
|
217
216
|
|
|
@@ -222,6 +221,9 @@ const LoadedSlot = <T extends AnyWidgetState>({
|
|
|
222
221
|
Logger.error("Model not found for modelId", modelId);
|
|
223
222
|
}
|
|
224
223
|
|
|
224
|
+
const css = model?.get("_css");
|
|
225
|
+
useMountCss(css, host);
|
|
226
|
+
|
|
225
227
|
useEffect(() => {
|
|
226
228
|
if (!htmlRef.current || !model) {
|
|
227
229
|
return;
|