@acrylblends/blends-frame 0.1.4 → 0.1.5
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/lib/client.js +11 -7
- package/lib/client.js.map +1 -1
- package/lib/contract.d.ts +2 -0
- package/lib/index.js +13 -4
- package/lib/index.js.map +1 -1
- package/lib/registry.d.ts +2 -0
- package/lib/types/client/registry-list.d.ts +4 -2
- package/lib/types/contract.d.ts +2 -0
- package/package.json +4 -4
package/lib/client.js
CHANGED
|
@@ -366,7 +366,7 @@ window.__ModuleLoader__.load({
|
|
|
366
366
|
status: "ready",
|
|
367
367
|
entries: value.entries.map((entry) => {
|
|
368
368
|
if (!isRecord$5(entry)) throw new Error("registry: entry");
|
|
369
|
-
const { name, description, owner, url, version, published, compatibility, source, installed, mine } = entry;
|
|
369
|
+
const { name, description, owner, url, version, published, compatibility, source, installed, mine, download } = entry;
|
|
370
370
|
if (typeof name !== "string" || typeof description !== "string" || typeof owner !== "string" || typeof url !== "string" || typeof version !== "string" || typeof compatibility !== "string" || typeof source !== "string" || typeof installed !== "boolean" || typeof mine !== "boolean") throw new Error("registry: entry");
|
|
371
371
|
return {
|
|
372
372
|
name,
|
|
@@ -378,7 +378,8 @@ window.__ModuleLoader__.load({
|
|
|
378
378
|
compatibility,
|
|
379
379
|
source,
|
|
380
380
|
installed,
|
|
381
|
-
mine
|
|
381
|
+
mine,
|
|
382
|
+
...typeof download === "number" && download > 0 ? { download } : {}
|
|
382
383
|
};
|
|
383
384
|
}),
|
|
384
385
|
readAt: value.readAt
|
|
@@ -47204,8 +47205,10 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47204
47205
|
const address = text.trim();
|
|
47205
47206
|
return /^github:[A-Za-z0-9][A-Za-z0-9-]*\/[A-Za-z0-9][A-Za-z0-9._-]*@[0-9][0-9A-Za-z.+-]*$/u.test(address) ? address : void 0;
|
|
47206
47207
|
}
|
|
47207
|
-
/**
|
|
47208
|
-
const
|
|
47208
|
+
/** A download size the way a person reads it: whole megabytes (1 MB = 1,000,000 bytes, as npm and the Blends pages count). */
|
|
47209
|
+
const megabytes = (bytes) => `${Math.max(1, Math.round(bytes / 1e6))} MB`;
|
|
47210
|
+
/** The question before anything is added: whose code it is, and what it downloads for this computer when it brings a native package. */
|
|
47211
|
+
const addQuestion = (name, owner, download) => `Add ${name} to your app? It runs code written by ${owner}, inside your app.${download === void 0 ? "" : ` It also downloads ${megabytes(download)} for this computer.`}`;
|
|
47209
47212
|
/** The answer after an add. */
|
|
47210
47213
|
function addedText(pulled) {
|
|
47211
47214
|
if (pulled.action === "unchanged") return `${pulled.name} v${pulled.version} was already in your app, so nothing changed.`;
|
|
@@ -47213,7 +47216,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47213
47216
|
return pulled.state === "active" ? `Done. ${pulled.name} is ${did} v${pulled.version} and running now.` : `${pulled.name} is ${did} v${pulled.version}, but it is not running yet (${pulled.state}).`;
|
|
47214
47217
|
}
|
|
47215
47218
|
/** One line under a row: who released it, which version and when. */
|
|
47216
|
-
const entryByline = (entry) => `by ${entry.owner} · v${entry.version}${entry.published === void 0 ? "" : ` · ${entry.published}`}`;
|
|
47219
|
+
const entryByline = (entry) => `by ${entry.owner} · v${entry.version}${entry.published === void 0 ? "" : ` · ${entry.published}`}${entry.download === void 0 ? "" : ` · ${megabytes(entry.download)} download`}`;
|
|
47217
47220
|
//#endregion
|
|
47218
47221
|
//#region src/client/RegistryView.tsx
|
|
47219
47222
|
/**
|
|
@@ -47297,7 +47300,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47297
47300
|
className: "acrylBlendsShareAsk",
|
|
47298
47301
|
role: "alertdialog",
|
|
47299
47302
|
"aria-label": `Add ${item.name}`,
|
|
47300
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: addQuestion(item.name, item.owner) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
47303
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: addQuestion(item.name, item.owner, item.download) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
47301
47304
|
className: "acrylBlendsShareRow",
|
|
47302
47305
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
47303
47306
|
type: "button",
|
|
@@ -47350,7 +47353,8 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47350
47353
|
setAsking({
|
|
47351
47354
|
source: entry.source,
|
|
47352
47355
|
name: entry.name,
|
|
47353
|
-
owner: entry.owner
|
|
47356
|
+
owner: entry.owner,
|
|
47357
|
+
...entry.download === void 0 ? {} : { download: entry.download }
|
|
47354
47358
|
});
|
|
47355
47359
|
},
|
|
47356
47360
|
children: adding === entry.source ? "Adding…" : "Add to my app"
|