@marimo-team/islands 0.19.8-dev21 → 0.19.8-dev24
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 +49 -33
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/pages/gallery-page.tsx +37 -6
- package/src/core/ai/context/providers/file.ts +1 -1
- package/src/core/static/__tests__/files.test.ts +195 -1
- package/src/core/static/files.ts +39 -9
- package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +7 -1
- package/src/utils/__tests__/blob.test.ts +3 -3
- package/src/utils/blob.ts +14 -27
package/dist/main.js
CHANGED
|
@@ -13114,11 +13114,11 @@ ${d.join("\n")}`;
|
|
|
13114
13114
|
var r = e.toUpperCase();
|
|
13115
13115
|
return methods.indexOf(r) > -1 ? r : e;
|
|
13116
13116
|
}
|
|
13117
|
-
function Request(e, r) {
|
|
13118
|
-
if (!(this instanceof Request)) throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
|
13117
|
+
function Request$1(e, r) {
|
|
13118
|
+
if (!(this instanceof Request$1)) throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
|
13119
13119
|
r || (r = {});
|
|
13120
13120
|
var c = r.body;
|
|
13121
|
-
if (e instanceof Request) {
|
|
13121
|
+
if (e instanceof Request$1) {
|
|
13122
13122
|
if (e.bodyUsed) throw TypeError("Already read");
|
|
13123
13123
|
this.url = e.url, this.credentials = e.credentials, r.headers || (this.headers = new Headers$2(e.headers)), this.method = e.method, this.mode = e.mode, this.signal = e.signal, !c && e._bodyInit != null && (c = e._bodyInit, e.bodyUsed = true);
|
|
13124
13124
|
} else this.url = String(e);
|
|
@@ -13162,7 +13162,7 @@ ${d.join("\n")}`;
|
|
|
13162
13162
|
}
|
|
13163
13163
|
function fetch$1(e, r) {
|
|
13164
13164
|
return new Promise(function(c, d) {
|
|
13165
|
-
var f = new Request(e, r);
|
|
13165
|
+
var f = new Request$1(e, r);
|
|
13166
13166
|
if (f.signal && f.signal.aborted) return d(new DOMException$1("Aborted", "AbortError"));
|
|
13167
13167
|
var _ = new XMLHttpRequest();
|
|
13168
13168
|
function v() {
|
|
@@ -13280,11 +13280,11 @@ ${d.join("\n")}`;
|
|
|
13280
13280
|
"POST",
|
|
13281
13281
|
"PUT",
|
|
13282
13282
|
"TRACE"
|
|
13283
|
-
], Request.prototype.clone = function() {
|
|
13284
|
-
return new Request(this, {
|
|
13283
|
+
], Request$1.prototype.clone = function() {
|
|
13284
|
+
return new Request$1(this, {
|
|
13285
13285
|
body: this._bodyInit
|
|
13286
13286
|
});
|
|
13287
|
-
}, Body.call(Request.prototype), Body.call(Response$1.prototype), Response$1.prototype.clone = function() {
|
|
13287
|
+
}, Body.call(Request$1.prototype), Body.call(Response$1.prototype), Response$1.prototype.clone = function() {
|
|
13288
13288
|
return new Response$1(this._bodyInit, {
|
|
13289
13289
|
status: this.status,
|
|
13290
13290
|
statusText: this.statusText,
|
|
@@ -13319,7 +13319,7 @@ ${d.join("\n")}`;
|
|
|
13319
13319
|
this.message = e, this.name = r, this.stack = Error(e).stack;
|
|
13320
13320
|
}, DOMException$1.prototype = Object.create(Error.prototype), DOMException$1.prototype.constructor = DOMException$1;
|
|
13321
13321
|
}
|
|
13322
|
-
fetch$1.polyfill = true, g$3.fetch || (g$3.fetch = fetch$1, g$3.Headers = Headers$2, g$3.Request = Request, g$3.Response = Response$1);
|
|
13322
|
+
fetch$1.polyfill = true, g$3.fetch || (g$3.fetch = fetch$1, g$3.Headers = Headers$2, g$3.Request = Request$1, g$3.Response = Response$1);
|
|
13323
13323
|
})), require_fetch_npm_browserify = __commonJSMin(((e, r) => {
|
|
13324
13324
|
init_fetch(), r.exports = self.fetch.bind(self);
|
|
13325
13325
|
})), require_HTTPTransport = __commonJSMin(((e) => {
|
|
@@ -44047,6 +44047,9 @@ ${c.sqlString}
|
|
|
44047
44047
|
function isStaticNotebook() {
|
|
44048
44048
|
return (window == null ? void 0 : window.__MARIMO_STATIC__) !== void 0;
|
|
44049
44049
|
}
|
|
44050
|
+
function getStaticVirtualFiles() {
|
|
44051
|
+
return invariant(window.__MARIMO_STATIC__ !== void 0, "Not a static notebook"), window.__MARIMO_STATIC__.files;
|
|
44052
|
+
}
|
|
44050
44053
|
function shallowCompare(e, r) {
|
|
44051
44054
|
return e === r ? true : e == null || r == null ? false : Array.isArray(e) && Array.isArray(r) ? arrayShallowEquals(e, r) : typeof e == "object" && typeof r == "object" ? shallowCompareObjects(e, r) : false;
|
|
44052
44055
|
}
|
|
@@ -64073,6 +64076,35 @@ ${O}`,
|
|
|
64073
64076
|
}
|
|
64074
64077
|
});
|
|
64075
64078
|
}
|
|
64079
|
+
function deserializeBlob(e) {
|
|
64080
|
+
var _a2;
|
|
64081
|
+
let [r, c] = e.split(",", 2), d = (_a2 = /^data:(.+);base64$/.exec(r)) == null ? void 0 : _a2[1], f = atob(c), _ = f.length, v = new Uint8Array(_);
|
|
64082
|
+
for (let e2 = 0; e2 < _; e2++) v[e2] = f.charCodeAt(e2);
|
|
64083
|
+
return new Blob([
|
|
64084
|
+
v
|
|
64085
|
+
], {
|
|
64086
|
+
type: d
|
|
64087
|
+
});
|
|
64088
|
+
}
|
|
64089
|
+
function withoutLeadingDot(e) {
|
|
64090
|
+
return e.startsWith(".") ? e.slice(1) : e;
|
|
64091
|
+
}
|
|
64092
|
+
function resolveVirtualFileURL(e, r = getStaticVirtualFiles()) {
|
|
64093
|
+
let c = maybeGetVirtualFile(e, r);
|
|
64094
|
+
if (!c) return e;
|
|
64095
|
+
let d = deserializeBlob(c);
|
|
64096
|
+
return URL.createObjectURL(d);
|
|
64097
|
+
}
|
|
64098
|
+
function maybeGetVirtualFile(e, r) {
|
|
64099
|
+
let c = document.baseURI;
|
|
64100
|
+
c.startsWith("blob:") && (c = c.replace("blob:", ""));
|
|
64101
|
+
let d = new URL(e, c).pathname, f = extractFilePath(e), _ = extractFilePath(d);
|
|
64102
|
+
return r[e] || r[withoutLeadingDot(e)] || r[d] || r[withoutLeadingDot(d)] || f && r[f] || _ && r[_];
|
|
64103
|
+
}
|
|
64104
|
+
function extractFilePath(e) {
|
|
64105
|
+
let r = e.indexOf("/@file/");
|
|
64106
|
+
return r === -1 ? null : e.slice(r);
|
|
64107
|
+
}
|
|
64076
64108
|
function createPlugin(e, r = {}) {
|
|
64077
64109
|
return {
|
|
64078
64110
|
withData(c) {
|
|
@@ -64340,10 +64372,13 @@ ${O}`,
|
|
|
64340
64372
|
return Logger.warn("AnyWidget value is not wire format:", e.value), e.value;
|
|
64341
64373
|
}, [
|
|
64342
64374
|
e.value
|
|
64343
|
-
]), { data: _, error: v, refetch: y } = useAsyncData(async () =>
|
|
64344
|
-
|
|
64345
|
-
return m2
|
|
64346
|
-
|
|
64375
|
+
]), { data: _, error: v, refetch: y } = useAsyncData(async () => {
|
|
64376
|
+
let e2 = asRemoteURL(c).toString();
|
|
64377
|
+
return isStaticNotebook() && (e2 = resolveVirtualFileURL(e2)), await import(e2).then(async (m2) => {
|
|
64378
|
+
await m2.__tla;
|
|
64379
|
+
return m2;
|
|
64380
|
+
});
|
|
64381
|
+
}, [
|
|
64347
64382
|
d
|
|
64348
64383
|
]), S = !!v;
|
|
64349
64384
|
(0, import_react.useEffect)(() => {
|
|
@@ -71094,25 +71129,6 @@ Image URL: ${r.imageUrl}`)), contextToXml({
|
|
|
71094
71129
|
}
|
|
71095
71130
|
};
|
|
71096
71131
|
const contextCallbacks = singleFacet();
|
|
71097
|
-
function deserializeBlob(e) {
|
|
71098
|
-
return new Promise((r, c) => {
|
|
71099
|
-
var _a2;
|
|
71100
|
-
try {
|
|
71101
|
-
let [c2, d] = e.split(",", 2), f = (_a2 = /^data:(.+);base64$/.exec(c2)) == null ? void 0 : _a2[1], _ = atob(d), v = _.length, y = new Uint8Array(v);
|
|
71102
|
-
for (let e2 = 0; e2 < v; e2++) y[e2] = _.charCodeAt(e2);
|
|
71103
|
-
r(new Blob([
|
|
71104
|
-
y
|
|
71105
|
-
], {
|
|
71106
|
-
type: f
|
|
71107
|
-
}));
|
|
71108
|
-
} catch (e2) {
|
|
71109
|
-
c(ensureError(e2));
|
|
71110
|
-
}
|
|
71111
|
-
});
|
|
71112
|
-
}
|
|
71113
|
-
function ensureError(e) {
|
|
71114
|
-
return e instanceof Error ? e : Error(`${e}`);
|
|
71115
|
-
}
|
|
71116
71132
|
var DEFAULT_FILE_SEARCH_CONFIG = {
|
|
71117
71133
|
maxDepth: 3,
|
|
71118
71134
|
maxResults: 20,
|
|
@@ -71244,7 +71260,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
|
|
|
71244
71260
|
type: S
|
|
71245
71261
|
});
|
|
71246
71262
|
else if (y.contents) try {
|
|
71247
|
-
E =
|
|
71263
|
+
E = deserializeBlob(base64ToDataURL(y.contents, S));
|
|
71248
71264
|
} catch {
|
|
71249
71265
|
E = new Blob([
|
|
71250
71266
|
y.contents
|
|
@@ -73176,7 +73192,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
|
|
|
73176
73192
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
73177
73193
|
}
|
|
73178
73194
|
}
|
|
73179
|
-
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.8-
|
|
73195
|
+
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.8-dev24"), showCodeInRunModeAtom = atom(true);
|
|
73180
73196
|
atom(null);
|
|
73181
73197
|
var import_compiler_runtime$88 = require_compiler_runtime();
|
|
73182
73198
|
function useKeydownOnElement(e, r) {
|