@acryldev/launcher-desktop 0.1.8 → 0.1.10

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
@@ -18,6 +18,8 @@ window.__ModuleLoader__.load({
18
18
  const LAUNCHER_START_PATH = `${LAUNCHER_API_PREFIX}/start`;
19
19
  const LAUNCHER_STOP_PATH = `${LAUNCHER_API_PREFIX}/stop`;
20
20
  const LAUNCHER_UPDATE_PATH = `${LAUNCHER_API_PREFIX}/update`;
21
+ /** Update the Control Center itself (the Blend copy it runs from) to its Blend's newer release. */
22
+ const LAUNCHER_UPDATE_SELF_PATH = `${LAUNCHER_API_PREFIX}/update-self`;
21
23
  /** Open ACRYL ADE (the Blend `acryl.ade` in `<home>/ade`, the folder `acryl ade` uses), made on first use, in a window or the browser. */
22
24
  const LAUNCHER_ADE_PATH = `${LAUNCHER_API_PREFIX}/ade`;
23
25
  const LAUNCHER_BLENDS_PATH = `${LAUNCHER_API_PREFIX}/blends`;
@@ -46,6 +48,20 @@ window.__ModuleLoader__.load({
46
48
  url.searchParams.set("name", name.toLowerCase().replace(/[^a-z0-9-]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, 40));
47
49
  return url.href;
48
50
  }
51
+ /**
52
+ * WebBoxes.ai's New WebBox form for a store Blend: with `?blend=<id>` the form opens on that registry Blend (the person signs in and presses
53
+ * Create there). A community Blend that lives on GitHub rather than in the registry (`source` is `github:owner/repo#tag`) deploys from its
54
+ * repository, as a shared app does.
55
+ */
56
+ function webboxesDeployBlendUrl(blend) {
57
+ const name = (blend.id.split(".").pop() ?? blend.id).toLowerCase().replace(/[^a-z0-9-]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, 40);
58
+ const repository = /^github:([A-Za-z0-9][A-Za-z0-9-]*\/[A-Za-z0-9_.-]+)(?:#.*)?$/u.exec(blend.source ?? "");
59
+ if (repository?.[1] !== void 0) return webboxesDeployUrl(`https://github.com/${repository[1]}`, name);
60
+ const url = new URL(WEBBOXES_NEW_BOX);
61
+ url.searchParams.set("blend", blend.id);
62
+ url.searchParams.set("name", name);
63
+ return url.href;
64
+ }
49
65
  /** A Blend id as `acryl new --from` takes it: it starts with a letter or digit, so it can never read as an option. */
50
66
  /** WebBoxes.ai's WebBoxes page: with `github` (a public https://github.com/owner/repo) and `name` it opens the New WebBox form filled in. */
51
67
  const WEBBOXES_NEW_BOX = "https://webboxes.ai/dashboard/webboxes";
@@ -102,6 +118,7 @@ window.__ModuleLoader__.load({
102
118
  start: (id) => post(LAUNCHER_START_PATH, { id }),
103
119
  stop: (id) => post(LAUNCHER_STOP_PATH, { id }),
104
120
  update: (id) => post(LAUNCHER_UPDATE_PATH, { id }),
121
+ updateSelf: () => post(LAUNCHER_UPDATE_SELF_PATH, {}),
105
122
  openAde: (surface) => post(LAUNCHER_ADE_PATH, { surface }),
106
123
  assistantFolder: async () => (await send(LAUNCHER_ASSISTANT_FOLDER_PATH, {})).folder,
107
124
  plugins: async (id) => (await send(LAUNCHER_PLUGINS_PATH, { id })).plugins,
@@ -158,7 +175,35 @@ window.__ModuleLoader__.load({
158
175
  /** The line a person types to start the app in a terminal: shown on the card's panel as "Runs". */
159
176
  const runsLine = (app) => `cd ${app.path} && npm run ${app.surface === "desktop" ? "desktop" : "dev"}`;
160
177
  /** A name for an app made from a registry id: its last part (`acrylblends.notes-desktop` gives `notes-desktop`), the same rule as the terminal's. */
178
+ /**
179
+ * The folder (and id) a name makes: any name a person types ("ACRYL ADE (EB)") becomes lower case letters, digits and dashes, starting with a
180
+ * letter ("acryl-ade-eb"), the form `acryl new` and npm accept. Empty when the name has no letter or digit to keep.
181
+ */
182
+ const folderName = (text) => text.normalize("NFKD").replace(/[\u0300-\u036f]/gu, "").toLowerCase().replace(/[^a-z0-9]+/gu, "-").replace(/^[^a-z]+/u, "").replace(/-+$/u, "");
161
183
  const blendAppName = (id) => id.split(".").at(-1)?.replace(/[^a-z0-9-]/gu, "-").replace(/^[^a-z]+/u, "") || "my-app";
184
+ /** The store's categories that hold at least one of `blends`, in the store's own order, each with its subcategories (by name) and counts. */
185
+ function storeCategories(blends) {
186
+ const byName = /* @__PURE__ */ new Map();
187
+ for (const blend of blends) {
188
+ if (blend.place === void 0) continue;
189
+ const category = byName.get(blend.place.category) ?? {
190
+ order: blend.place.order,
191
+ count: 0,
192
+ subs: /* @__PURE__ */ new Map()
193
+ };
194
+ category.count += 1;
195
+ if (blend.place.subcategory !== "") category.subs.set(blend.place.subcategory, (category.subs.get(blend.place.subcategory) ?? 0) + 1);
196
+ byName.set(blend.place.category, category);
197
+ }
198
+ return [...byName].sort(([a, x], [b, y]) => x.order - y.order || a.localeCompare(b)).map(([name, category]) => ({
199
+ name,
200
+ count: category.count,
201
+ subs: [...category.subs].sort(([a], [b]) => a.localeCompare(b)).map(([sub, count]) => ({
202
+ name: sub,
203
+ count
204
+ }))
205
+ }));
206
+ }
162
207
  //#endregion
163
208
  //#region src/client/fonts.ts
164
209
  /**
@@ -289,6 +334,16 @@ window.__ModuleLoader__.load({
289
334
  const token = getComputedStyle(document.documentElement).getPropertyValue("--dsw-alias-bg-base");
290
335
  setDark(isDarkColor(token) ?? window.matchMedia?.("(prefers-color-scheme: dark)").matches ?? true);
291
336
  }, [open]);
337
+ /** A new app: make it and show the list it answers with, or hand the reason it was refused back to the form that asked (shown beside its button). */
338
+ const create = (0, react.useCallback)(async (request) => {
339
+ try {
340
+ setState(await api.create(request));
341
+ setProblem(void 0);
342
+ return;
343
+ } catch (cause) {
344
+ return message(cause);
345
+ }
346
+ }, [api]);
292
347
  /** A change: send it, show the list it answers with, or the reason it was refused. */
293
348
  const act = (0, react.useCallback)(async (run) => {
294
349
  try {
@@ -383,6 +438,12 @@ window.__ModuleLoader__.load({
383
438
  role: "alert",
384
439
  children: problem
385
440
  }),
441
+ state?.self === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelfBanner, {
442
+ self: state.self,
443
+ onUpdate: () => {
444
+ act(() => api.updateSelf());
445
+ }
446
+ }),
386
447
  state?.job == null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(JobBanner, { job: state.job }),
387
448
  view === "apps" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppsView, {
388
449
  api,
@@ -403,9 +464,9 @@ window.__ModuleLoader__.load({
403
464
  return done;
404
465
  },
405
466
  onCreate: async (request) => {
406
- const done = await act(() => api.create(request));
407
- if (done) setPanel("none");
408
- return done;
467
+ const refused = await create(request);
468
+ if (refused === void 0) setPanel("none");
469
+ return refused;
409
470
  },
410
471
  onStart: (id) => act(() => api.start(id)),
411
472
  onStop: (id) => act(() => api.stop(id)),
@@ -433,10 +494,11 @@ window.__ModuleLoader__.load({
433
494
  view === "store" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StoreView, {
434
495
  api,
435
496
  state,
497
+ openExternal,
436
498
  onCreate: async (request) => {
437
- const done = await act(() => api.create(request));
438
- if (done) setView("apps");
439
- return done;
499
+ const refused = await create(request);
500
+ if (refused === void 0) setView("apps");
501
+ return refused;
440
502
  }
441
503
  }),
442
504
  view === "cloud" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Empty, {
@@ -479,6 +541,33 @@ window.__ModuleLoader__.load({
479
541
  ]
480
542
  });
481
543
  }
544
+ /** This app's own update: a newer release with its button, the update as it runs, then "open it again", or why it did not finish. */
545
+ function SelfBanner({ self, onUpdate }) {
546
+ const head = self.status === "available" ? `${self.name} ${self.update} is out` : self.status === "updating" ? `Updating ${self.name} to ${self.update}${self.since === void 0 ? "" : ` · ${elapsed(self.since)}`}` : self.status === "done" ? `${self.name} is updated to ${self.update}` : `${self.name} could not be updated to ${self.update}`;
547
+ const text = self.status === "available" ? `You have ${self.version}. Updating brings the new release in and keeps any change you made (a git merge), then installs its packages.` : self.status === "updating" ? "Getting the release, merging it in, then npm install. The screen may reload while it works; that is expected." : self.status === "done" ? `Quit ${self.name} and open it again to finish: the window and its packages load once, when it opens.` : "Nothing was lost: what the copy had stays. The last lines it printed:";
548
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
549
+ className: "acrylHomeJob",
550
+ role: "status",
551
+ "aria-label": `${self.name} update`,
552
+ children: [
553
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: head }),
554
+ "\n",
555
+ text,
556
+ self.output === void 0 || self.output === "" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
557
+ className: "acrylHomeLog",
558
+ children: self.output
559
+ }),
560
+ self.status === "available" || self.status === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: ["\n", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
561
+ type: "button",
562
+ className: "acrylHomeBtn",
563
+ "data-small": true,
564
+ "data-primary": true,
565
+ onClick: onUpdate,
566
+ children: self.status === "failed" ? "Try again" : `Update to ${self.update}`
567
+ })] }) : null
568
+ ]
569
+ });
570
+ }
482
571
  /** "42s" or "2m 05s" since a moment; the screen re-renders on every state poll, so it counts up. */
483
572
  function elapsed(since) {
484
573
  const seconds = Math.max(0, Math.round((Date.now() - since) / 1e3));
@@ -1471,21 +1560,24 @@ window.__ModuleLoader__.load({
1471
1560
  function NewAppForm({ state, blend, onCreate, onCancel }) {
1472
1561
  const [where, setWhere] = (0, react.useState)(state.appsFolder);
1473
1562
  const [name, setName] = (0, react.useState)(blend === void 0 ? "" : blendAppName(blend.id));
1563
+ const folder = folderName(name);
1564
+ const [refused, setRefused] = (0, react.useState)(void 0);
1474
1565
  const [starter, setStarter] = (0, react.useState)(state.starters[0]?.value ?? "blank");
1475
1566
  const [surface, setSurface] = (0, react.useState)("web");
1476
1567
  const [busy, setBusy] = (0, react.useState)(false);
1477
- const line = `cd ${where} && acryl new ${name === "" ? "<name>" : name} ${blend === void 0 ? starter : `--from ${blend.source ?? blend.id}`}`;
1568
+ const line = `cd ${where} && acryl new ${folder === "" ? "<name>" : folder} ${blend === void 0 ? starter : `--from ${blend.source ?? blend.id}`}`;
1478
1569
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1479
1570
  className: "acrylHomePanel acrylHomeForm",
1480
1571
  onSubmit: (event) => {
1481
1572
  event.preventDefault();
1573
+ setRefused(void 0);
1482
1574
  setBusy(true);
1483
1575
  onCreate({
1484
1576
  where,
1485
- name,
1577
+ name: folder,
1486
1578
  surface,
1487
1579
  ...blend === void 0 ? { starter } : { blend: blend.source ?? blend.id }
1488
- }).finally(() => {
1580
+ }).then(setRefused).finally(() => {
1489
1581
  setBusy(false);
1490
1582
  });
1491
1583
  },
@@ -1511,14 +1603,22 @@ window.__ModuleLoader__.load({
1511
1603
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Name" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1512
1604
  className: "acrylHomeInput",
1513
1605
  value: name,
1514
- placeholder: "my-app",
1606
+ placeholder: "My app",
1515
1607
  autoFocus: true,
1516
1608
  onChange: (event) => {
1517
1609
  setName(event.target.value);
1610
+ setRefused(void 0);
1518
1611
  },
1519
1612
  "aria-label": "Name"
1520
1613
  })]
1521
1614
  }),
1615
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1616
+ className: "acrylHomeNote",
1617
+ children: folder === "" ? "Type a name with at least one letter." : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: ["Folder ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1618
+ className: "acrylHomeMeta",
1619
+ children: `${where.replace(/[\\/]+$/u, "")}/${folder}`
1620
+ })] })
1621
+ }),
1522
1622
  blend !== void 0 && blend.origin === "community" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1523
1623
  className: "acrylHomeNote",
1524
1624
  "data-warn": true,
@@ -1602,24 +1702,50 @@ window.__ModuleLoader__.load({
1602
1702
  type: "submit",
1603
1703
  className: "acrylHomeBtn",
1604
1704
  "data-primary": true,
1605
- disabled: busy || name === "",
1606
- children: "Make it"
1705
+ disabled: busy || folder === "",
1706
+ children: busy ? "Making it..." : "Make it"
1607
1707
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1608
1708
  type: "button",
1609
1709
  className: "acrylHomeBtn",
1710
+ disabled: busy,
1610
1711
  onClick: onCancel,
1611
1712
  children: "Cancel"
1612
1713
  })]
1714
+ }),
1715
+ busy ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1716
+ className: "acrylHomeNote",
1717
+ role: "status",
1718
+ children: [
1719
+ "Making ",
1720
+ folder,
1721
+ " in ",
1722
+ where,
1723
+ ": copying ",
1724
+ blend === void 0 ? "the starter" : blend.name,
1725
+ " and installing its packages. This can take a minute or two."
1726
+ ]
1727
+ }) : null,
1728
+ refused === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1729
+ className: "acrylHomeNote",
1730
+ "data-error": true,
1731
+ role: "alert",
1732
+ children: ["Not made: ", refused]
1613
1733
  })
1614
1734
  ]
1615
1735
  });
1616
1736
  }
1617
- /** The public registry's Blends, read when the store opens; "Make an app" opens the New app form for the chosen one. */
1618
- function StoreView({ api, state, onCreate }) {
1737
+ /**
1738
+ * The public registry's Blends, read when the store opens: browsed by the store's categories and subcategories, by who released them and by search; a
1739
+ * card opens the Blend's page (its picture, what it is, where it sits), and "Make an app" opens the New app form for it.
1740
+ */
1741
+ function StoreView({ api, state, onCreate, openExternal }) {
1619
1742
  const [blends, setBlends] = (0, react.useState)(void 0);
1620
1743
  const [failed, setFailed] = (0, react.useState)(void 0);
1621
1744
  const [search, setSearch] = (0, react.useState)("");
1622
1745
  const [origin, setOrigin] = (0, react.useState)("all");
1746
+ const [category, setCategory] = (0, react.useState)(void 0);
1747
+ const [subcategory, setSubcategory] = (0, react.useState)(void 0);
1748
+ const [viewing, setViewing] = (0, react.useState)(void 0);
1623
1749
  const [chosen, setChosen] = (0, react.useState)(void 0);
1624
1750
  const [attempt, setAttempt] = (0, react.useState)(0);
1625
1751
  (0, react.useEffect)(() => {
@@ -1635,8 +1761,78 @@ window.__ModuleLoader__.load({
1635
1761
  };
1636
1762
  }, [api, attempt]);
1637
1763
  const needle = search.trim().toLowerCase();
1638
- const shown = (blends ?? []).filter((blend) => (origin === "all" || blend.origin === origin) && (needle === "" || `${blend.name} ${blend.id} ${blend.category} ${blend.description}`.toLowerCase().includes(needle)));
1764
+ const byOrigin = (blends ?? []).filter((blend) => origin === "all" || blend.origin === origin);
1765
+ const categories = storeCategories(byOrigin);
1766
+ const current = categories.find((entry) => entry.name === category);
1767
+ const shown = byOrigin.filter((blend) => (category === void 0 || blend.place?.category === category) && (subcategory === void 0 || blend.place?.subcategory === subcategory) && (needle === "" || `${blend.name} ${blend.id} ${blend.category} ${blend.description}`.toLowerCase().includes(needle)));
1639
1768
  const count = (which) => (blends ?? []).filter((blend) => blend.origin === which).length;
1769
+ const choose = (name) => {
1770
+ setCategory(name);
1771
+ setSubcategory(void 0);
1772
+ };
1773
+ const makeForm = chosen !== void 0 && state !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NewAppForm, {
1774
+ state,
1775
+ blend: chosen,
1776
+ onCreate,
1777
+ onCancel: () => {
1778
+ setChosen(void 0);
1779
+ }
1780
+ }, chosen.id) : null;
1781
+ if (viewing !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1782
+ className: "acrylHomeForm",
1783
+ children: [
1784
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1785
+ className: "acrylHomeRow",
1786
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1787
+ type: "button",
1788
+ className: "acrylHomeBtn",
1789
+ "data-small": true,
1790
+ onClick: () => {
1791
+ setViewing(void 0);
1792
+ setChosen(void 0);
1793
+ },
1794
+ children: "‹ All Blends"
1795
+ }), viewing.place === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1796
+ className: "acrylHomeMeta",
1797
+ children: [viewing.place.category, viewing.place.subcategory === "" ? "" : ` › ${viewing.place.subcategory}`]
1798
+ })]
1799
+ }),
1800
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BlendPage, { blend: viewing }),
1801
+ makeForm,
1802
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1803
+ className: "acrylHomeActs",
1804
+ children: [
1805
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1806
+ type: "button",
1807
+ className: "acrylHomeBtn",
1808
+ "data-primary": true,
1809
+ disabled: state === void 0 || chosen !== void 0,
1810
+ onClick: () => {
1811
+ setChosen(viewing);
1812
+ },
1813
+ children: "Make an app"
1814
+ }),
1815
+ viewing.page === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1816
+ type: "button",
1817
+ className: "acrylHomeBtn",
1818
+ onClick: () => {
1819
+ if (viewing.page !== void 0) openExternal(viewing.page);
1820
+ },
1821
+ children: "Open its store page"
1822
+ }),
1823
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1824
+ type: "button",
1825
+ className: "acrylHomeBtn",
1826
+ title: `Opens WebBoxes.ai on ${viewing.name}: sign in, press Create, then Publish`,
1827
+ onClick: () => {
1828
+ openExternal(webboxesDeployBlendUrl(viewing));
1829
+ },
1830
+ children: "Deploy to WebBoxes.ai"
1831
+ })
1832
+ ]
1833
+ })
1834
+ ]
1835
+ });
1640
1836
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1641
1837
  className: "acrylHomeForm",
1642
1838
  children: [
@@ -1647,7 +1843,7 @@ window.__ModuleLoader__.load({
1647
1843
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1648
1844
  className: "acrylHomeNote",
1649
1845
  children: [
1650
- "Ready-made apps from the public registry (acrylblends.github.io/blends). Making one is the same as ",
1846
+ "Ready-made apps from the public registry (acrylblends.github.io/blends). Open one to see what it is; making one is the same as ",
1651
1847
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1652
1848
  className: "acrylHomeMeta",
1653
1849
  children: "acryl new <name> --from <id>"
@@ -1655,14 +1851,7 @@ window.__ModuleLoader__.load({
1655
1851
  "."
1656
1852
  ]
1657
1853
  }),
1658
- chosen !== void 0 && state !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NewAppForm, {
1659
- state,
1660
- blend: chosen,
1661
- onCreate,
1662
- onCancel: () => {
1663
- setChosen(void 0);
1664
- }
1665
- }, chosen.id) : null,
1854
+ makeForm,
1666
1855
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1667
1856
  className: "acrylHomeSearch",
1668
1857
  type: "search",
@@ -1678,14 +1867,18 @@ window.__ModuleLoader__.load({
1678
1867
  role: "group",
1679
1868
  "aria-label": "Who released it",
1680
1869
  children: [
1681
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1870
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1682
1871
  type: "button",
1683
1872
  className: "acrylHomeChip",
1684
1873
  "aria-pressed": origin === "all",
1685
1874
  onClick: () => {
1686
1875
  setOrigin("all");
1687
1876
  },
1688
- children: "All"
1877
+ children: [
1878
+ "All (",
1879
+ (blends ?? []).length,
1880
+ ")"
1881
+ ]
1689
1882
  }),
1690
1883
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1691
1884
  type: "button",
@@ -1717,103 +1910,265 @@ window.__ModuleLoader__.load({
1717
1910
  })
1718
1911
  ]
1719
1912
  }),
1720
- failed !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1721
- className: "acrylHomeNote",
1722
- "data-error": true,
1723
- role: "alert",
1724
- children: [
1725
- failed,
1726
- " ",
1727
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1913
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1914
+ className: "acrylHomeStore",
1915
+ children: [categories.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1916
+ className: "acrylHomeStoreCats",
1917
+ role: "group",
1918
+ "aria-label": "Categories",
1919
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1728
1920
  type: "button",
1729
- className: "acrylHomeBtn",
1730
- "data-small": true,
1921
+ className: "acrylHomeNavItem",
1922
+ "aria-pressed": category === void 0,
1923
+ "aria-label": `All categories (${String(byOrigin.length)})`,
1731
1924
  onClick: () => {
1732
- setAttempt(attempt + 1);
1925
+ choose(void 0);
1733
1926
  },
1734
- children: "Try again"
1735
- })
1736
- ]
1737
- }) : null,
1738
- blends === void 0 && failed === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1739
- className: "acrylHomeNote",
1740
- children: "Reading the registry..."
1741
- }) : null,
1742
- blends !== void 0 && shown.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1743
- className: "acrylHomeNote",
1744
- children: "No Blend matches."
1745
- }) : null,
1746
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1747
- className: "acrylHomeCards",
1748
- children: shown.map((blend) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1749
- className: "acrylHomeApp",
1927
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "All categories" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1928
+ className: "acrylHomeCount",
1929
+ children: byOrigin.length
1930
+ })]
1931
+ }), categories.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1932
+ type: "button",
1933
+ className: "acrylHomeNavItem",
1934
+ "aria-pressed": category === entry.name,
1935
+ "aria-label": `${entry.name} (${String(entry.count)})`,
1936
+ onClick: () => {
1937
+ choose(entry.name);
1938
+ },
1939
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: entry.name }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1940
+ className: "acrylHomeCount",
1941
+ children: entry.count
1942
+ })]
1943
+ }, entry.name))]
1944
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1945
+ className: "acrylHomeStoreMain",
1750
1946
  children: [
1751
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1752
- className: "acrylHomeHead",
1753
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1754
- className: "acrylHomeIcon",
1755
- style: { background: iconColor(blend.id) },
1756
- children: initial(blend.name)
1757
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1758
- style: { minWidth: 0 },
1759
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1760
- className: "acrylHomeName",
1761
- children: blend.name
1762
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1763
- className: "acrylHomeMeta",
1764
- children: blend.id
1765
- })]
1766
- })]
1767
- }),
1768
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1769
- className: "acrylHomeDesc",
1770
- children: blend.description
1947
+ current === void 0 || current.subs.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1948
+ className: "acrylHomeRow",
1949
+ role: "group",
1950
+ "aria-label": `Subcategories of ${current.name}`,
1951
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1952
+ type: "button",
1953
+ className: "acrylHomeChip",
1954
+ "aria-pressed": subcategory === void 0,
1955
+ onClick: () => {
1956
+ setSubcategory(void 0);
1957
+ },
1958
+ children: ["All of ", current.name]
1959
+ }), current.subs.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1960
+ type: "button",
1961
+ className: "acrylHomeChip",
1962
+ "aria-pressed": subcategory === entry.name,
1963
+ onClick: () => {
1964
+ setSubcategory(entry.name);
1965
+ },
1966
+ children: [
1967
+ entry.name,
1968
+ " (",
1969
+ entry.count,
1970
+ ")"
1971
+ ]
1972
+ }, entry.name))]
1771
1973
  }),
1772
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1773
- className: "acrylHomeCardFoot",
1774
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1775
- className: "acrylHomeRow",
1974
+ failed !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1975
+ className: "acrylHomeNote",
1976
+ "data-error": true,
1977
+ role: "alert",
1978
+ children: [
1979
+ failed,
1980
+ " ",
1981
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1982
+ type: "button",
1983
+ className: "acrylHomeBtn",
1984
+ "data-small": true,
1985
+ onClick: () => {
1986
+ setAttempt(attempt + 1);
1987
+ },
1988
+ children: "Try again"
1989
+ })
1990
+ ]
1991
+ }) : null,
1992
+ blends === void 0 && failed === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1993
+ className: "acrylHomeNote",
1994
+ children: "Reading the registry..."
1995
+ }) : null,
1996
+ blends !== void 0 && shown.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1997
+ className: "acrylHomeNote",
1998
+ children: "No Blend matches."
1999
+ }) : null,
2000
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2001
+ className: "acrylHomeCards",
2002
+ children: shown.map((blend) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2003
+ className: "acrylHomeApp",
1776
2004
  children: [
1777
- blend.origin === "official" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1778
- className: "acrylHomePill",
1779
- title: "Released by the ACRYL project",
1780
- children: "Official"
1781
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1782
- className: "acrylHomePill",
1783
- title: "Released by someone outside the ACRYL project; its code is not reviewed",
1784
- children: "Community"
2005
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2006
+ type: "button",
2007
+ className: "acrylHomeHead acrylHomeHeadLink",
2008
+ title: `Open ${blend.name}: its picture and what it is`,
2009
+ "aria-label": `Open ${blend.name}`,
2010
+ onClick: () => {
2011
+ setViewing(blend);
2012
+ setChosen(void 0);
2013
+ },
2014
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2015
+ className: "acrylHomeIcon",
2016
+ style: { background: iconColor(blend.id) },
2017
+ children: initial(blend.name)
2018
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2019
+ style: { minWidth: 0 },
2020
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2021
+ className: "acrylHomeName",
2022
+ children: blend.name
2023
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2024
+ className: "acrylHomeMeta",
2025
+ children: blend.id
2026
+ })]
2027
+ })]
1785
2028
  }),
1786
- blend.publisher === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1787
- className: "acrylHomeMeta",
1788
- children: ["by @", blend.publisher]
2029
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2030
+ className: "acrylHomeDesc",
2031
+ children: blend.description
1789
2032
  }),
1790
- blend.category === "" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1791
- className: "acrylHomePill",
1792
- children: blend.category
1793
- }),
1794
- blend.version === "" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1795
- className: "acrylHomeMeta",
1796
- children: blend.version
2033
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OriginPills, { blend }),
2034
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2035
+ className: "acrylHomeCardFoot",
2036
+ "data-wrap": "",
2037
+ children: [
2038
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2039
+ type: "button",
2040
+ className: "acrylHomeBtn",
2041
+ "data-small": true,
2042
+ onClick: () => {
2043
+ setViewing(blend);
2044
+ setChosen(void 0);
2045
+ },
2046
+ children: "View"
2047
+ }),
2048
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2049
+ type: "button",
2050
+ className: "acrylHomeBtn",
2051
+ "data-small": true,
2052
+ title: `Opens WebBoxes.ai on ${blend.name}: sign in, press Create, then Publish`,
2053
+ onClick: () => {
2054
+ openExternal(webboxesDeployBlendUrl(blend));
2055
+ },
2056
+ children: "Deploy to WebBoxes.ai"
2057
+ }),
2058
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2059
+ type: "button",
2060
+ className: "acrylHomeBtn",
2061
+ "data-small": true,
2062
+ "data-primary": true,
2063
+ disabled: state === void 0,
2064
+ onClick: () => {
2065
+ setChosen(blend);
2066
+ },
2067
+ children: "Make an app"
2068
+ })
2069
+ ]
1797
2070
  })
1798
2071
  ]
1799
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1800
- type: "button",
1801
- className: "acrylHomeBtn",
1802
- "data-small": true,
1803
- "data-primary": true,
1804
- disabled: state === void 0,
1805
- onClick: () => {
1806
- setChosen(blend);
1807
- },
1808
- children: "Make an app"
1809
- })]
2072
+ }, blend.id))
1810
2073
  })
1811
2074
  ]
1812
- }, blend.id))
2075
+ })]
1813
2076
  })
1814
2077
  ]
1815
2078
  });
1816
2079
  }
2080
+ /** Who released a Blend, where the store files it and its version, as the card and the Blend's page show them. */
2081
+ function OriginPills({ blend }) {
2082
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2083
+ className: "acrylHomeRow",
2084
+ children: [
2085
+ blend.origin === "official" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2086
+ className: "acrylHomePill",
2087
+ title: "Released by the ACRYL project",
2088
+ children: "Official"
2089
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2090
+ className: "acrylHomePill",
2091
+ title: "Released by someone outside the ACRYL project; its code is not reviewed",
2092
+ children: "Community"
2093
+ }),
2094
+ blend.publisher === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2095
+ className: "acrylHomeMeta",
2096
+ children: ["by @", blend.publisher]
2097
+ }),
2098
+ blend.category === "" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2099
+ className: "acrylHomePill",
2100
+ title: blend.category,
2101
+ children: blend.category
2102
+ }),
2103
+ blend.version === "" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2104
+ className: "acrylHomeMeta",
2105
+ children: blend.version
2106
+ })
2107
+ ]
2108
+ });
2109
+ }
2110
+ /** A Blend's own page in the store: its first page's picture (when it has one), its name, who released it, where it sits, and what it is. */
2111
+ function BlendPage({ blend }) {
2112
+ const [pictured, setPictured] = (0, react.useState)(true);
2113
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
2114
+ className: "acrylHomeForm",
2115
+ "aria-label": blend.name,
2116
+ children: [
2117
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2118
+ className: "acrylHomeHead",
2119
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2120
+ className: "acrylHomeIcon",
2121
+ style: { background: iconColor(blend.id) },
2122
+ children: initial(blend.name)
2123
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2124
+ style: { minWidth: 0 },
2125
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
2126
+ style: { margin: 0 },
2127
+ children: blend.name
2128
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2129
+ className: "acrylHomeMeta",
2130
+ children: [blend.id, blend.source === void 0 ? "" : ` · ${blend.source}`]
2131
+ })]
2132
+ })]
2133
+ }),
2134
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OriginPills, { blend }),
2135
+ blend.screenshot !== void 0 && pictured ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
2136
+ src: blend.screenshot,
2137
+ alt: `${blend.name}, its first page`,
2138
+ loading: "lazy",
2139
+ onError: () => {
2140
+ setPictured(false);
2141
+ },
2142
+ style: {
2143
+ display: "block",
2144
+ width: "100%",
2145
+ maxHeight: 420,
2146
+ objectFit: "cover",
2147
+ objectPosition: "top",
2148
+ border: "1px solid var(--h-border)",
2149
+ borderRadius: 12
2150
+ }
2151
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2152
+ className: "acrylHomeNote",
2153
+ children: "No picture of this Blend yet."
2154
+ }),
2155
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2156
+ className: "acrylHomeDesc",
2157
+ style: {
2158
+ WebkitLineClamp: "unset",
2159
+ display: "block"
2160
+ },
2161
+ children: blend.description
2162
+ }),
2163
+ blend.origin === "community" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2164
+ className: "acrylHomeNote",
2165
+ "data-warn": true,
2166
+ role: "note",
2167
+ children: "A Community Blend: released by someone outside the ACRYL project. Its code is not reviewed; make it only if you trust who released it."
2168
+ }) : null
2169
+ ]
2170
+ });
2171
+ }
1817
2172
  function AddFolderForm({ onAdd, onCancel }) {
1818
2173
  const [path, setPath] = (0, react.useState)("");
1819
2174
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
@@ -2211,12 +2566,23 @@ button.acrylHomeApp { cursor: pointer; }
2211
2566
  .acrylHomeApp:hover, .acrylHomeApp[aria-pressed="true"] { border-color: var(--h-line); }
2212
2567
  .acrylHomeApp[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--h-accent); border-color: var(--h-accent); }
2213
2568
  .acrylHomeHead { display: flex; gap: 12px; align-items: center; min-width: 0; }
2569
+ .acrylHomeHeadLink { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
2570
+ .acrylHomeHeadLink:hover .acrylHomeName { text-decoration: underline; }
2571
+ .acrylHomeHeadLink:focus-visible { outline: 2px solid var(--h-accent); outline-offset: 2px; border-radius: 6px; }
2214
2572
  .acrylHomeIcon { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: #fff; font-weight: 600; font-size: 14px; }
2215
2573
  .acrylHomeName { font-weight: 600; overflow-wrap: anywhere; }
2216
2574
  .acrylHomeMeta { color: var(--h-dim); font: 12px/18px ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; }
2217
2575
  .acrylHomeDesc { margin: 0; color: var(--h-dim); font-size: 13px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
2218
2576
  .acrylHomeRow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 20px; }
2219
2577
  .acrylHomeCardFoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
2578
+ .acrylHomeCardFoot[data-wrap] { flex-wrap: wrap; justify-content: flex-start; }
2579
+ .acrylHomePill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2580
+ .acrylHomeStore { display: grid; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); gap: 20px; align-items: start; }
2581
+ .acrylHomeStoreCats { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; max-height: calc(100vh - 140px); overflow-y: auto; }
2582
+ .acrylHomeStoreCats .acrylHomeNavItem { height: auto; min-height: 30px; padding: 5px 10px; gap: 8px; }
2583
+ .acrylHomeStoreCats .acrylHomeNavItem[aria-pressed="true"] { background: var(--h-fill); color: var(--h-text); }
2584
+ .acrylHomeStoreMain { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
2585
+ @media (max-width: 760px) { .acrylHomeStore { grid-template-columns: minmax(0, 1fr); } .acrylHomeStoreCats { position: static; max-height: 220px; } }
2220
2586
  .acrylHomeState { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--h-dim); }
2221
2587
  .acrylHomeState[data-state="running"], .acrylHomeState[data-state="starting"] { color: var(--h-ok); }
2222
2588
  .acrylHomeState[data-state="missing"] { color: var(--h-warn); }
@@ -2264,6 +2630,7 @@ button.acrylHomeApp { cursor: pointer; }
2264
2630
  .acrylHome[data-skin="site"] .acrylHomeMain { background-image: linear-gradient(to right, var(--h-grid) 1px, transparent 1px), linear-gradient(to bottom, var(--h-grid) 1px, transparent 1px); background-size: 64px 64px; background-position: -1px -1px; }
2265
2631
  .acrylHome[data-skin="site"] .acrylHomeBrand { font-size: 12px; font-weight: 650; letter-spacing: .31em; text-transform: uppercase; }
2266
2632
  .acrylHome[data-skin="site"] .acrylHomeNavItem { height: 34px; font-size: 10px; letter-spacing: .1em; border-left: 2px solid transparent; }
2633
+ .acrylHome[data-skin="site"] .acrylHomeStoreCats .acrylHomeNavItem[aria-pressed="true"] { border-left-color: var(--h-text); background: var(--h-fill); color: var(--h-text); font-weight: 500; }
2267
2634
  .acrylHome[data-skin="site"] .acrylHomeNavItem[aria-current="page"] { border-left-color: var(--h-text); background: var(--h-fill); color: var(--h-text); font-weight: 500; }
2268
2635
  .acrylHome[data-skin="site"] .acrylHomeBtn { height: 34px; padding: 0 14px; border: 1px solid var(--h-border); background: transparent; color: var(--h-text); font-size: 9px; font-weight: 500; transition: background .16s ease, color .16s ease, border-color .16s ease; }
2269
2636
  .acrylHome[data-skin="site"] .acrylHomeBtn:hover:not(:disabled) { border-color: var(--h-text); background: transparent; color: var(--h-text); }