@marimo-team/islands 0.20.0 → 0.20.1
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
|
@@ -73400,7 +73400,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
|
|
|
73400
73400
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
73401
73401
|
}
|
|
73402
73402
|
}
|
|
73403
|
-
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.20.
|
|
73403
|
+
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.20.1"), showCodeInRunModeAtom = atom(true);
|
|
73404
73404
|
atom(null);
|
|
73405
73405
|
var import_compiler_runtime$88 = require_compiler_runtime();
|
|
73406
73406
|
function useKeydownOnElement(e, r) {
|
|
@@ -94413,26 +94413,33 @@ ${c}
|
|
|
94413
94413
|
}
|
|
94414
94414
|
update(e) {
|
|
94415
94415
|
let r = __privateGet(this, _n4);
|
|
94416
|
-
|
|
94417
|
-
|
|
94418
|
-
return;
|
|
94419
|
-
}
|
|
94416
|
+
__privateSet(this, _n4, e);
|
|
94417
|
+
let c = false;
|
|
94420
94418
|
if (e.width !== r.width || e.height !== r.height) {
|
|
94421
94419
|
let r2 = globalThis.devicePixelRatio ?? 1;
|
|
94422
|
-
__privateGet(this, _e8).width = e.width * r2, __privateGet(this, _e8).height = e.height * r2, __privateGet(this, _e8).style.width = `${e.width}px`, __privateGet(this, _e8).style.height = `${e.height}px
|
|
94420
|
+
__privateGet(this, _e8).width = e.width * r2, __privateGet(this, _e8).height = e.height * r2, __privateGet(this, _e8).style.width = `${e.width}px`, __privateGet(this, _e8).style.height = `${e.height}px`, c = true;
|
|
94421
|
+
}
|
|
94422
|
+
if (e.chartBase64 !== __privateGet(this, _s)) {
|
|
94423
|
+
__privateMethod(this, _MatplotlibRenderer_instances, c_fn).call(this, e.chartBase64);
|
|
94424
|
+
return;
|
|
94423
94425
|
}
|
|
94424
|
-
(e.selectionColor !== r.selectionColor || e.selectionOpacity !== r.selectionOpacity || e.strokeWidth !== r.strokeWidth
|
|
94426
|
+
(c || e.selectionColor !== r.selectionColor || e.selectionOpacity !== r.selectionOpacity || e.strokeWidth !== r.strokeWidth) && __privateGet(this, _l).call(this);
|
|
94425
94427
|
}
|
|
94426
94428
|
}, _e8 = new WeakMap(), _t5 = new WeakMap(), _n4 = new WeakMap(), _r2 = new WeakMap(), _i3 = new WeakMap(), _a2 = new WeakMap(), _o2 = new WeakMap(), _s = new WeakMap(), _MatplotlibRenderer_instances = new WeakSet(), c_fn = function(e) {
|
|
94427
94429
|
__privateSet(this, _s, e), __privateWrapper(this, _o2)._++;
|
|
94428
94430
|
let r = __privateGet(this, _o2);
|
|
94429
94431
|
__privateSet(this, _r2, {
|
|
94430
94432
|
type: "idle"
|
|
94431
|
-
});
|
|
94432
|
-
let c =
|
|
94433
|
-
|
|
94434
|
-
|
|
94435
|
-
|
|
94433
|
+
}), __privateSet(this, _a2, null);
|
|
94434
|
+
let c = __privateGet(this, _e8).getContext("2d");
|
|
94435
|
+
if (c) {
|
|
94436
|
+
let e2 = globalThis.devicePixelRatio ?? 1;
|
|
94437
|
+
c.setTransform(e2, 0, 0, e2, 0, 0), c.clearRect(0, 0, __privateGet(this, _n4).width, __privateGet(this, _n4).height);
|
|
94438
|
+
}
|
|
94439
|
+
let d = new Image();
|
|
94440
|
+
d.onload = () => {
|
|
94441
|
+
r === __privateGet(this, _o2) && (__privateSet(this, _a2, d), __privateGet(this, _l).call(this));
|
|
94442
|
+
}, d.src = e;
|
|
94436
94443
|
}, _l = new WeakMap(), _u = new WeakMap(), _d2 = new WeakMap(), _f2 = new WeakMap(), _p = new WeakMap(), _m = new WeakMap(), _h2 = new WeakMap(), _g2 = new WeakMap(), __ = new WeakMap(), _v = new WeakMap(), _y = new WeakMap(), _b3 = new WeakMap(), _x = new WeakMap(), _S = new WeakMap(), _k), MatplotlibPlugin = class {
|
|
94437
94444
|
constructor() {
|
|
94438
94445
|
__publicField(this, "tagName", "marimo-matplotlib");
|
package/package.json
CHANGED
|
@@ -29,14 +29,9 @@ export function formatKeymapExtension(hotkeys: HotkeyProvider) {
|
|
|
29
29
|
preventDefault: true,
|
|
30
30
|
run: (ev) => {
|
|
31
31
|
const currentLanguage = getCurrentLanguageAdapter(ev);
|
|
32
|
-
// Early return if not a supported language
|
|
33
|
-
if (currentLanguage !== "markdown" && currentLanguage !== "python") {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Toggle between markdown and python
|
|
38
32
|
const destinationLanguage =
|
|
39
|
-
currentLanguage === "
|
|
33
|
+
currentLanguage === "markdown" ? "python" : "markdown";
|
|
34
|
+
|
|
40
35
|
const response = toggleToLanguage(ev, destinationLanguage, {
|
|
41
36
|
force: true,
|
|
42
37
|
});
|
|
@@ -330,10 +330,7 @@ export class MatplotlibRenderer {
|
|
|
330
330
|
const prev = this.#state;
|
|
331
331
|
this.#state = state;
|
|
332
332
|
|
|
333
|
-
|
|
334
|
-
this.#loadImage(state.chartBase64);
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
333
|
+
let needsRedraw = false;
|
|
337
334
|
|
|
338
335
|
// Update canvas dimensions if changed
|
|
339
336
|
if (state.width !== prev.width || state.height !== prev.height) {
|
|
@@ -342,15 +339,20 @@ export class MatplotlibRenderer {
|
|
|
342
339
|
this.#canvas.height = state.height * dpr;
|
|
343
340
|
this.#canvas.style.width = `${state.width}px`;
|
|
344
341
|
this.#canvas.style.height = `${state.height}px`;
|
|
342
|
+
needsRedraw = true;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (state.chartBase64 !== this.#currentChartBase64) {
|
|
346
|
+
this.#loadImage(state.chartBase64);
|
|
347
|
+
return;
|
|
345
348
|
}
|
|
346
349
|
|
|
347
350
|
// Redraw if style props changed or dimensions changed
|
|
348
351
|
if (
|
|
352
|
+
needsRedraw ||
|
|
349
353
|
state.selectionColor !== prev.selectionColor ||
|
|
350
354
|
state.selectionOpacity !== prev.selectionOpacity ||
|
|
351
|
-
state.strokeWidth !== prev.strokeWidth
|
|
352
|
-
state.width !== prev.width ||
|
|
353
|
-
state.height !== prev.height
|
|
355
|
+
state.strokeWidth !== prev.strokeWidth
|
|
354
356
|
) {
|
|
355
357
|
this.#drawCanvas();
|
|
356
358
|
}
|
|
@@ -364,6 +366,15 @@ export class MatplotlibRenderer {
|
|
|
364
366
|
// Clear selection on new chart
|
|
365
367
|
this.#interaction = { type: "idle" };
|
|
366
368
|
|
|
369
|
+
// Clear stale image so old content doesn't linger while new image loads
|
|
370
|
+
this.#image = null;
|
|
371
|
+
const ctx = this.#canvas.getContext("2d");
|
|
372
|
+
if (ctx) {
|
|
373
|
+
const dpr = globalThis.devicePixelRatio ?? 1;
|
|
374
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
375
|
+
ctx.clearRect(0, 0, this.#state.width, this.#state.height);
|
|
376
|
+
}
|
|
377
|
+
|
|
367
378
|
const img = new Image();
|
|
368
379
|
img.onload = () => {
|
|
369
380
|
if (generation !== this.#imageGeneration) {
|