@acrylblends/blends-frame 0.1.4 → 0.1.6
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 +56 -10
- package/lib/client.js.map +1 -1
- package/lib/contract.d.ts +5 -0
- package/lib/index.js +15 -5
- package/lib/index.js.map +1 -1
- package/lib/registry.d.ts +2 -0
- package/lib/types/client/registry-list.d.ts +8 -4
- package/lib/types/contract.d.ts +5 -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, origin, 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,
|
|
@@ -376,9 +376,11 @@ window.__ModuleLoader__.load({
|
|
|
376
376
|
version,
|
|
377
377
|
...typeof published === "string" ? { published } : {},
|
|
378
378
|
compatibility,
|
|
379
|
+
origin: origin === "official" ? "official" : "community",
|
|
379
380
|
source,
|
|
380
381
|
installed,
|
|
381
|
-
mine
|
|
382
|
+
mine,
|
|
383
|
+
...typeof download === "number" && download > 0 ? { download } : {}
|
|
382
384
|
};
|
|
383
385
|
}),
|
|
384
386
|
readAt: value.readAt
|
|
@@ -47191,10 +47193,11 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47191
47193
|
/** A plugin for a different kind of app (a stock DeepSeek Harness plugin) cannot run in a Blends app; it is hidden until the person asks to see all. */
|
|
47192
47194
|
const forOtherApps = (entry) => entry.compatibility === "DSH stock";
|
|
47193
47195
|
/** The entries a search shows: by name, description or owner, every word of it; the ones for other apps only when asked. Order is kept. */
|
|
47194
|
-
function filterRegistry(entries, query, showAll) {
|
|
47196
|
+
function filterRegistry(entries, query, showAll, origin = "all") {
|
|
47195
47197
|
const words = query.toLowerCase().split(/\s+/u).filter((word) => word !== "");
|
|
47196
47198
|
return entries.filter((entry) => {
|
|
47197
47199
|
if (!showAll && forOtherApps(entry)) return false;
|
|
47200
|
+
if (origin !== "all" && entry.origin !== origin) return false;
|
|
47198
47201
|
const text = `${entry.name} ${entry.description} ${entry.owner}`.toLowerCase();
|
|
47199
47202
|
return words.every((word) => text.includes(word));
|
|
47200
47203
|
});
|
|
@@ -47204,8 +47207,10 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47204
47207
|
const address = text.trim();
|
|
47205
47208
|
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
47209
|
}
|
|
47207
|
-
/**
|
|
47208
|
-
const
|
|
47210
|
+
/** A download size the way a person reads it: whole megabytes (1 MB = 1,000,000 bytes, as npm and the Blends pages count). */
|
|
47211
|
+
const megabytes = (bytes) => `${Math.max(1, Math.round(bytes / 1e6))} MB`;
|
|
47212
|
+
/** The question before anything is added: whose code it is (a community plugin says so: nobody at ACRYL reviewed it), and what it downloads for this computer. */
|
|
47213
|
+
const addQuestion = (name, owner, download, origin) => `Add ${name} to your app? ${origin === "community" ? `It is a community plugin: it runs code written by ${owner}, inside your app, and ACRYL has not reviewed it.` : `It runs code written by ${owner}, inside your app.`}${download === void 0 ? "" : ` It also downloads ${megabytes(download)} for this computer.`}`;
|
|
47209
47214
|
/** The answer after an add. */
|
|
47210
47215
|
function addedText(pulled) {
|
|
47211
47216
|
if (pulled.action === "unchanged") return `${pulled.name} v${pulled.version} was already in your app, so nothing changed.`;
|
|
@@ -47213,13 +47218,27 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47213
47218
|
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
47219
|
}
|
|
47215
47220
|
/** 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}`}`;
|
|
47221
|
+
const entryByline = (entry) => `by ${entry.owner} · v${entry.version}${entry.published === void 0 ? "" : ` · ${entry.published}`}${entry.download === void 0 ? "" : ` · ${megabytes(entry.download)} download`}`;
|
|
47217
47222
|
//#endregion
|
|
47218
47223
|
//#region src/client/RegistryView.tsx
|
|
47219
47224
|
/**
|
|
47220
47225
|
* The Registry tab of Settings > Plugins: the public Cordis plugin registry, searchable, with one button to add a plugin to this app. Plain words;
|
|
47221
47226
|
* the address, compatibility and the tool's own messages are behind "Details". Nothing is added without the person's yes (the question names whose code it is).
|
|
47222
47227
|
*/
|
|
47228
|
+
const ORIGINS = [
|
|
47229
|
+
{
|
|
47230
|
+
value: "all",
|
|
47231
|
+
label: "All"
|
|
47232
|
+
},
|
|
47233
|
+
{
|
|
47234
|
+
value: "official",
|
|
47235
|
+
label: "Official"
|
|
47236
|
+
},
|
|
47237
|
+
{
|
|
47238
|
+
value: "community",
|
|
47239
|
+
label: "Community"
|
|
47240
|
+
}
|
|
47241
|
+
];
|
|
47223
47242
|
const ownerOfAddress = (source) => /^github:([^/]+)\//u.exec(source)?.[1] ?? "its author";
|
|
47224
47243
|
const nameOfAddress = (source) => /^github:[^/]+\/([^@]+)@/u.exec(source)?.[1] ?? source;
|
|
47225
47244
|
function RegistryView({ api, onAdded }) {
|
|
@@ -47227,6 +47246,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47227
47246
|
const [reads, setReads] = (0, react.useState)(0);
|
|
47228
47247
|
const [query, setQuery] = (0, react.useState)("");
|
|
47229
47248
|
const [showAll, setShowAll] = (0, react.useState)(false);
|
|
47249
|
+
const [origin, setOrigin] = (0, react.useState)("all");
|
|
47230
47250
|
const [asking, setAsking] = (0, react.useState)(void 0);
|
|
47231
47251
|
const [adding, setAdding] = (0, react.useState)(void 0);
|
|
47232
47252
|
const [said, setSaid] = (0, react.useState)(void 0);
|
|
@@ -47253,10 +47273,11 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47253
47273
|
};
|
|
47254
47274
|
}, [api, reads]);
|
|
47255
47275
|
const entries = load.status === "ready" && load.registry.status === "ready" ? load.registry.entries : [];
|
|
47256
|
-
const shown = (0, react.useMemo)(() => filterRegistry(entries, query, showAll), [
|
|
47276
|
+
const shown = (0, react.useMemo)(() => filterRegistry(entries, query, showAll, origin), [
|
|
47257
47277
|
entries,
|
|
47258
47278
|
query,
|
|
47259
|
-
showAll
|
|
47279
|
+
showAll,
|
|
47280
|
+
origin
|
|
47260
47281
|
]);
|
|
47261
47282
|
const hidden = (0, react.useMemo)(() => entries.filter(forOtherApps).length, [entries]);
|
|
47262
47283
|
const add = (0, react.useCallback)(async (source) => {
|
|
@@ -47297,7 +47318,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47297
47318
|
className: "acrylBlendsShareAsk",
|
|
47298
47319
|
role: "alertdialog",
|
|
47299
47320
|
"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", {
|
|
47321
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: addQuestion(item.name, item.owner, item.download, item.origin) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
47301
47322
|
className: "acrylBlendsShareRow",
|
|
47302
47323
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
47303
47324
|
type: "button",
|
|
@@ -47328,6 +47349,12 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47328
47349
|
className: "acrylBlendsRegHead",
|
|
47329
47350
|
children: [
|
|
47330
47351
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: entry.name }),
|
|
47352
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
47353
|
+
className: "acrylBlendsPlugBy",
|
|
47354
|
+
"data-origin": entry.origin,
|
|
47355
|
+
title: entry.origin === "official" ? "Released by the ACRYL project" : "Released by someone outside the ACRYL project; its code is not reviewed",
|
|
47356
|
+
children: entry.origin === "official" ? "Official" : "Community"
|
|
47357
|
+
}),
|
|
47331
47358
|
entry.mine && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
47332
47359
|
className: "acrylBlendsPlugBy",
|
|
47333
47360
|
children: "Yours"
|
|
@@ -47350,7 +47377,9 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47350
47377
|
setAsking({
|
|
47351
47378
|
source: entry.source,
|
|
47352
47379
|
name: entry.name,
|
|
47353
|
-
owner: entry.owner
|
|
47380
|
+
owner: entry.owner,
|
|
47381
|
+
origin: entry.origin,
|
|
47382
|
+
...entry.download === void 0 ? {} : { download: entry.download }
|
|
47354
47383
|
});
|
|
47355
47384
|
},
|
|
47356
47385
|
children: adding === entry.source ? "Adding…" : "Add to my app"
|
|
@@ -47425,6 +47454,19 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47425
47454
|
]
|
|
47426
47455
|
})]
|
|
47427
47456
|
}),
|
|
47457
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
47458
|
+
className: "acrylBlendsRegOrigin",
|
|
47459
|
+
role: "group",
|
|
47460
|
+
"aria-label": "Who made it",
|
|
47461
|
+
children: ORIGINS.map((choice) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
47462
|
+
type: "button",
|
|
47463
|
+
"aria-pressed": origin === choice.value,
|
|
47464
|
+
onClick: () => {
|
|
47465
|
+
setOrigin(choice.value);
|
|
47466
|
+
},
|
|
47467
|
+
children: choice.label
|
|
47468
|
+
}, choice.value))
|
|
47469
|
+
}),
|
|
47428
47470
|
said !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
47429
47471
|
className: said.kind === "ok" ? "acrylBlendsPlugSaid" : "acrylBlendsNote",
|
|
47430
47472
|
"data-error": said.kind === "error" || void 0,
|
|
@@ -49298,6 +49340,10 @@ button.acrylBlendsFrow:hover { background: var(--bf-surface-2); }
|
|
|
49298
49340
|
.acrylBlendsRegAdd { padding: 3px 10px; border: 1px solid var(--bf-accent); border-radius: 5px; background: var(--bf-accent-dim); color: var(--bf-strong); font: inherit; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
|
|
49299
49341
|
.acrylBlendsRegAdd:disabled { opacity: .5; cursor: default; }
|
|
49300
49342
|
.acrylBlendsRegAdded { color: var(--bf-ok); font-size: 11.5px; }
|
|
49343
|
+
.acrylBlendsRegOrigin { display: flex; gap: 4px; margin-bottom: 10px; }
|
|
49344
|
+
.acrylBlendsRegOrigin button { padding: 2px 9px; border: 1px solid var(--bf-border-2); border-radius: 5px; background: transparent; color: var(--bf-text-2); font: inherit; font-size: 11.5px; cursor: pointer; }
|
|
49345
|
+
.acrylBlendsRegOrigin button[aria-pressed="true"] { border-color: var(--bf-accent); background: var(--bf-accent-dim); color: var(--bf-strong); }
|
|
49346
|
+
.acrylBlendsPlugBy[data-origin="official"] { color: var(--bf-ok); border-color: currentColor; }
|
|
49301
49347
|
.acrylBlendsRegAll { color: var(--bf-text-2); font-size: 11.5px; display: inline-flex; align-items: center; cursor: pointer; }
|
|
49302
49348
|
.acrylBlendsRegByAddress { display: grid; gap: 3px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--bf-border); }
|
|
49303
49349
|
.acrylBlendsRegByAddress b { color: var(--bf-strong); font-size: 12px; }
|