@acrylblends/blends-frame 0.1.5 → 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 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, download } = 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,6 +376,7 @@ 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
382
  mine,
@@ -47192,10 +47193,11 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47192
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. */
47193
47194
  const forOtherApps = (entry) => entry.compatibility === "DSH stock";
47194
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. */
47195
- function filterRegistry(entries, query, showAll) {
47196
+ function filterRegistry(entries, query, showAll, origin = "all") {
47196
47197
  const words = query.toLowerCase().split(/\s+/u).filter((word) => word !== "");
47197
47198
  return entries.filter((entry) => {
47198
47199
  if (!showAll && forOtherApps(entry)) return false;
47200
+ if (origin !== "all" && entry.origin !== origin) return false;
47199
47201
  const text = `${entry.name} ${entry.description} ${entry.owner}`.toLowerCase();
47200
47202
  return words.every((word) => text.includes(word));
47201
47203
  });
@@ -47207,8 +47209,8 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47207
47209
  }
47208
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). */
47209
47211
  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.`}`;
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.`}`;
47212
47214
  /** The answer after an add. */
47213
47215
  function addedText(pulled) {
47214
47216
  if (pulled.action === "unchanged") return `${pulled.name} v${pulled.version} was already in your app, so nothing changed.`;
@@ -47223,6 +47225,20 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47223
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;
47224
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).
47225
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
+ ];
47226
47242
  const ownerOfAddress = (source) => /^github:([^/]+)\//u.exec(source)?.[1] ?? "its author";
47227
47243
  const nameOfAddress = (source) => /^github:[^/]+\/([^@]+)@/u.exec(source)?.[1] ?? source;
47228
47244
  function RegistryView({ api, onAdded }) {
@@ -47230,6 +47246,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47230
47246
  const [reads, setReads] = (0, react.useState)(0);
47231
47247
  const [query, setQuery] = (0, react.useState)("");
47232
47248
  const [showAll, setShowAll] = (0, react.useState)(false);
47249
+ const [origin, setOrigin] = (0, react.useState)("all");
47233
47250
  const [asking, setAsking] = (0, react.useState)(void 0);
47234
47251
  const [adding, setAdding] = (0, react.useState)(void 0);
47235
47252
  const [said, setSaid] = (0, react.useState)(void 0);
@@ -47256,10 +47273,11 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47256
47273
  };
47257
47274
  }, [api, reads]);
47258
47275
  const entries = load.status === "ready" && load.registry.status === "ready" ? load.registry.entries : [];
47259
- const shown = (0, react.useMemo)(() => filterRegistry(entries, query, showAll), [
47276
+ const shown = (0, react.useMemo)(() => filterRegistry(entries, query, showAll, origin), [
47260
47277
  entries,
47261
47278
  query,
47262
- showAll
47279
+ showAll,
47280
+ origin
47263
47281
  ]);
47264
47282
  const hidden = (0, react.useMemo)(() => entries.filter(forOtherApps).length, [entries]);
47265
47283
  const add = (0, react.useCallback)(async (source) => {
@@ -47300,7 +47318,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47300
47318
  className: "acrylBlendsShareAsk",
47301
47319
  role: "alertdialog",
47302
47320
  "aria-label": `Add ${item.name}`,
47303
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: addQuestion(item.name, item.owner, item.download) }), /* @__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", {
47304
47322
  className: "acrylBlendsShareRow",
47305
47323
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
47306
47324
  type: "button",
@@ -47331,6 +47349,12 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47331
47349
  className: "acrylBlendsRegHead",
47332
47350
  children: [
47333
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
+ }),
47334
47358
  entry.mine && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
47335
47359
  className: "acrylBlendsPlugBy",
47336
47360
  children: "Yours"
@@ -47354,6 +47378,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47354
47378
  source: entry.source,
47355
47379
  name: entry.name,
47356
47380
  owner: entry.owner,
47381
+ origin: entry.origin,
47357
47382
  ...entry.download === void 0 ? {} : { download: entry.download }
47358
47383
  });
47359
47384
  },
@@ -47429,6 +47454,19 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
47429
47454
  ]
47430
47455
  })]
47431
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
+ }),
47432
47470
  said !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
47433
47471
  className: said.kind === "ok" ? "acrylBlendsPlugSaid" : "acrylBlendsNote",
47434
47472
  "data-error": said.kind === "error" || void 0,
@@ -49302,6 +49340,10 @@ button.acrylBlendsFrow:hover { background: var(--bf-surface-2); }
49302
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; }
49303
49341
  .acrylBlendsRegAdd:disabled { opacity: .5; cursor: default; }
49304
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; }
49305
49347
  .acrylBlendsRegAll { color: var(--bf-text-2); font-size: 11.5px; display: inline-flex; align-items: center; cursor: pointer; }
49306
49348
  .acrylBlendsRegByAddress { display: grid; gap: 3px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--bf-border); }
49307
49349
  .acrylBlendsRegByAddress b { color: var(--bf-strong); font-size: 12px; }