@acryldev/launcher-desktop 0.1.9 → 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`;
@@ -116,6 +118,7 @@ window.__ModuleLoader__.load({
116
118
  start: (id) => post(LAUNCHER_START_PATH, { id }),
117
119
  stop: (id) => post(LAUNCHER_STOP_PATH, { id }),
118
120
  update: (id) => post(LAUNCHER_UPDATE_PATH, { id }),
121
+ updateSelf: () => post(LAUNCHER_UPDATE_SELF_PATH, {}),
119
122
  openAde: (surface) => post(LAUNCHER_ADE_PATH, { surface }),
120
123
  assistantFolder: async () => (await send(LAUNCHER_ASSISTANT_FOLDER_PATH, {})).folder,
121
124
  plugins: async (id) => (await send(LAUNCHER_PLUGINS_PATH, { id })).plugins,
@@ -172,7 +175,35 @@ window.__ModuleLoader__.load({
172
175
  /** The line a person types to start the app in a terminal: shown on the card's panel as "Runs". */
173
176
  const runsLine = (app) => `cd ${app.path} && npm run ${app.surface === "desktop" ? "desktop" : "dev"}`;
174
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, "");
175
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
+ }
176
207
  //#endregion
177
208
  //#region src/client/fonts.ts
178
209
  /**
@@ -303,6 +334,16 @@ window.__ModuleLoader__.load({
303
334
  const token = getComputedStyle(document.documentElement).getPropertyValue("--dsw-alias-bg-base");
304
335
  setDark(isDarkColor(token) ?? window.matchMedia?.("(prefers-color-scheme: dark)").matches ?? true);
305
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]);
306
347
  /** A change: send it, show the list it answers with, or the reason it was refused. */
307
348
  const act = (0, react.useCallback)(async (run) => {
308
349
  try {
@@ -397,6 +438,12 @@ window.__ModuleLoader__.load({
397
438
  role: "alert",
398
439
  children: problem
399
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
+ }),
400
447
  state?.job == null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(JobBanner, { job: state.job }),
401
448
  view === "apps" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppsView, {
402
449
  api,
@@ -417,9 +464,9 @@ window.__ModuleLoader__.load({
417
464
  return done;
418
465
  },
419
466
  onCreate: async (request) => {
420
- const done = await act(() => api.create(request));
421
- if (done) setPanel("none");
422
- return done;
467
+ const refused = await create(request);
468
+ if (refused === void 0) setPanel("none");
469
+ return refused;
423
470
  },
424
471
  onStart: (id) => act(() => api.start(id)),
425
472
  onStop: (id) => act(() => api.stop(id)),
@@ -449,9 +496,9 @@ window.__ModuleLoader__.load({
449
496
  state,
450
497
  openExternal,
451
498
  onCreate: async (request) => {
452
- const done = await act(() => api.create(request));
453
- if (done) setView("apps");
454
- return done;
499
+ const refused = await create(request);
500
+ if (refused === void 0) setView("apps");
501
+ return refused;
455
502
  }
456
503
  }),
457
504
  view === "cloud" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Empty, {
@@ -494,6 +541,33 @@ window.__ModuleLoader__.load({
494
541
  ]
495
542
  });
496
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
+ }
497
571
  /** "42s" or "2m 05s" since a moment; the screen re-renders on every state poll, so it counts up. */
498
572
  function elapsed(since) {
499
573
  const seconds = Math.max(0, Math.round((Date.now() - since) / 1e3));
@@ -1486,21 +1560,24 @@ window.__ModuleLoader__.load({
1486
1560
  function NewAppForm({ state, blend, onCreate, onCancel }) {
1487
1561
  const [where, setWhere] = (0, react.useState)(state.appsFolder);
1488
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);
1489
1565
  const [starter, setStarter] = (0, react.useState)(state.starters[0]?.value ?? "blank");
1490
1566
  const [surface, setSurface] = (0, react.useState)("web");
1491
1567
  const [busy, setBusy] = (0, react.useState)(false);
1492
- 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}`}`;
1493
1569
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1494
1570
  className: "acrylHomePanel acrylHomeForm",
1495
1571
  onSubmit: (event) => {
1496
1572
  event.preventDefault();
1573
+ setRefused(void 0);
1497
1574
  setBusy(true);
1498
1575
  onCreate({
1499
1576
  where,
1500
- name,
1577
+ name: folder,
1501
1578
  surface,
1502
1579
  ...blend === void 0 ? { starter } : { blend: blend.source ?? blend.id }
1503
- }).finally(() => {
1580
+ }).then(setRefused).finally(() => {
1504
1581
  setBusy(false);
1505
1582
  });
1506
1583
  },
@@ -1526,14 +1603,22 @@ window.__ModuleLoader__.load({
1526
1603
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Name" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1527
1604
  className: "acrylHomeInput",
1528
1605
  value: name,
1529
- placeholder: "my-app",
1606
+ placeholder: "My app",
1530
1607
  autoFocus: true,
1531
1608
  onChange: (event) => {
1532
1609
  setName(event.target.value);
1610
+ setRefused(void 0);
1533
1611
  },
1534
1612
  "aria-label": "Name"
1535
1613
  })]
1536
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
+ }),
1537
1622
  blend !== void 0 && blend.origin === "community" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1538
1623
  className: "acrylHomeNote",
1539
1624
  "data-warn": true,
@@ -1617,24 +1702,50 @@ window.__ModuleLoader__.load({
1617
1702
  type: "submit",
1618
1703
  className: "acrylHomeBtn",
1619
1704
  "data-primary": true,
1620
- disabled: busy || name === "",
1621
- children: "Make it"
1705
+ disabled: busy || folder === "",
1706
+ children: busy ? "Making it..." : "Make it"
1622
1707
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1623
1708
  type: "button",
1624
1709
  className: "acrylHomeBtn",
1710
+ disabled: busy,
1625
1711
  onClick: onCancel,
1626
1712
  children: "Cancel"
1627
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]
1628
1733
  })
1629
1734
  ]
1630
1735
  });
1631
1736
  }
1632
- /** The public registry's Blends, read when the store opens; "Make an app" opens the New app form for the chosen one. */
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
+ */
1633
1741
  function StoreView({ api, state, onCreate, openExternal }) {
1634
1742
  const [blends, setBlends] = (0, react.useState)(void 0);
1635
1743
  const [failed, setFailed] = (0, react.useState)(void 0);
1636
1744
  const [search, setSearch] = (0, react.useState)("");
1637
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);
1638
1749
  const [chosen, setChosen] = (0, react.useState)(void 0);
1639
1750
  const [attempt, setAttempt] = (0, react.useState)(0);
1640
1751
  (0, react.useEffect)(() => {
@@ -1650,8 +1761,78 @@ window.__ModuleLoader__.load({
1650
1761
  };
1651
1762
  }, [api, attempt]);
1652
1763
  const needle = search.trim().toLowerCase();
1653
- 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)));
1654
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
+ });
1655
1836
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1656
1837
  className: "acrylHomeForm",
1657
1838
  children: [
@@ -1662,7 +1843,7 @@ window.__ModuleLoader__.load({
1662
1843
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1663
1844
  className: "acrylHomeNote",
1664
1845
  children: [
1665
- "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 ",
1666
1847
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1667
1848
  className: "acrylHomeMeta",
1668
1849
  children: "acryl new <name> --from <id>"
@@ -1670,14 +1851,7 @@ window.__ModuleLoader__.load({
1670
1851
  "."
1671
1852
  ]
1672
1853
  }),
1673
- chosen !== void 0 && state !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NewAppForm, {
1674
- state,
1675
- blend: chosen,
1676
- onCreate,
1677
- onCancel: () => {
1678
- setChosen(void 0);
1679
- }
1680
- }, chosen.id) : null,
1854
+ makeForm,
1681
1855
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1682
1856
  className: "acrylHomeSearch",
1683
1857
  type: "search",
@@ -1693,14 +1867,18 @@ window.__ModuleLoader__.load({
1693
1867
  role: "group",
1694
1868
  "aria-label": "Who released it",
1695
1869
  children: [
1696
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1870
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1697
1871
  type: "button",
1698
1872
  className: "acrylHomeChip",
1699
1873
  "aria-pressed": origin === "all",
1700
1874
  onClick: () => {
1701
1875
  setOrigin("all");
1702
1876
  },
1703
- children: "All"
1877
+ children: [
1878
+ "All (",
1879
+ (blends ?? []).length,
1880
+ ")"
1881
+ ]
1704
1882
  }),
1705
1883
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1706
1884
  type: "button",
@@ -1732,116 +1910,265 @@ window.__ModuleLoader__.load({
1732
1910
  })
1733
1911
  ]
1734
1912
  }),
1735
- failed !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1736
- className: "acrylHomeNote",
1737
- "data-error": true,
1738
- role: "alert",
1739
- children: [
1740
- failed,
1741
- " ",
1742
- /* @__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", {
1743
1920
  type: "button",
1744
- className: "acrylHomeBtn",
1745
- "data-small": true,
1921
+ className: "acrylHomeNavItem",
1922
+ "aria-pressed": category === void 0,
1923
+ "aria-label": `All categories (${String(byOrigin.length)})`,
1746
1924
  onClick: () => {
1747
- setAttempt(attempt + 1);
1925
+ choose(void 0);
1748
1926
  },
1749
- children: "Try again"
1750
- })
1751
- ]
1752
- }) : null,
1753
- blends === void 0 && failed === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1754
- className: "acrylHomeNote",
1755
- children: "Reading the registry..."
1756
- }) : null,
1757
- blends !== void 0 && shown.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1758
- className: "acrylHomeNote",
1759
- children: "No Blend matches."
1760
- }) : null,
1761
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1762
- className: "acrylHomeCards",
1763
- children: shown.map((blend) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1764
- 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",
1765
1946
  children: [
1766
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1767
- className: "acrylHomeHead",
1768
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1769
- className: "acrylHomeIcon",
1770
- style: { background: iconColor(blend.id) },
1771
- children: initial(blend.name)
1772
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1773
- style: { minWidth: 0 },
1774
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1775
- className: "acrylHomeName",
1776
- children: blend.name
1777
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1778
- className: "acrylHomeMeta",
1779
- children: blend.id
1780
- })]
1781
- })]
1782
- }),
1783
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1784
- className: "acrylHomeDesc",
1785
- 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))]
1786
1973
  }),
1787
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1788
- className: "acrylHomeCardFoot",
1974
+ failed !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1975
+ className: "acrylHomeNote",
1976
+ "data-error": true,
1977
+ role: "alert",
1789
1978
  children: [
1790
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1791
- className: "acrylHomeRow",
1792
- children: [
1793
- blend.origin === "official" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1794
- className: "acrylHomePill",
1795
- title: "Released by the ACRYL project",
1796
- children: "Official"
1797
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1798
- className: "acrylHomePill",
1799
- title: "Released by someone outside the ACRYL project; its code is not reviewed",
1800
- children: "Community"
1801
- }),
1802
- blend.publisher === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1803
- className: "acrylHomeMeta",
1804
- children: ["by @", blend.publisher]
1805
- }),
1806
- blend.category === "" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1807
- className: "acrylHomePill",
1808
- children: blend.category
1809
- }),
1810
- blend.version === "" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1811
- className: "acrylHomeMeta",
1812
- children: blend.version
1813
- })
1814
- ]
1815
- }),
1816
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1817
- type: "button",
1818
- className: "acrylHomeBtn",
1819
- "data-small": true,
1820
- title: `Opens WebBoxes.ai on ${blend.name}: sign in, press Create, then Publish`,
1821
- onClick: () => {
1822
- openExternal(webboxesDeployBlendUrl(blend));
1823
- },
1824
- children: "Deploy to WebBoxes.ai"
1825
- }),
1979
+ failed,
1980
+ " ",
1826
1981
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1827
1982
  type: "button",
1828
1983
  className: "acrylHomeBtn",
1829
1984
  "data-small": true,
1830
- "data-primary": true,
1831
- disabled: state === void 0,
1832
1985
  onClick: () => {
1833
- setChosen(blend);
1986
+ setAttempt(attempt + 1);
1834
1987
  },
1835
- children: "Make an app"
1988
+ children: "Try again"
1836
1989
  })
1837
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",
2004
+ children: [
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
+ })]
2028
+ }),
2029
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2030
+ className: "acrylHomeDesc",
2031
+ children: blend.description
2032
+ }),
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
+ ]
2070
+ })
2071
+ ]
2072
+ }, blend.id))
1838
2073
  })
1839
2074
  ]
1840
- }, blend.id))
2075
+ })]
2076
+ })
2077
+ ]
2078
+ });
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
1841
2106
  })
1842
2107
  ]
1843
2108
  });
1844
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
+ }
1845
2172
  function AddFolderForm({ onAdd, onCancel }) {
1846
2173
  const [path, setPath] = (0, react.useState)("");
1847
2174
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
@@ -2239,12 +2566,23 @@ button.acrylHomeApp { cursor: pointer; }
2239
2566
  .acrylHomeApp:hover, .acrylHomeApp[aria-pressed="true"] { border-color: var(--h-line); }
2240
2567
  .acrylHomeApp[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--h-accent); border-color: var(--h-accent); }
2241
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; }
2242
2572
  .acrylHomeIcon { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: #fff; font-weight: 600; font-size: 14px; }
2243
2573
  .acrylHomeName { font-weight: 600; overflow-wrap: anywhere; }
2244
2574
  .acrylHomeMeta { color: var(--h-dim); font: 12px/18px ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; }
2245
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; }
2246
2576
  .acrylHomeRow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 20px; }
2247
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; } }
2248
2586
  .acrylHomeState { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--h-dim); }
2249
2587
  .acrylHomeState[data-state="running"], .acrylHomeState[data-state="starting"] { color: var(--h-ok); }
2250
2588
  .acrylHomeState[data-state="missing"] { color: var(--h-warn); }
@@ -2292,6 +2630,7 @@ button.acrylHomeApp { cursor: pointer; }
2292
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; }
2293
2631
  .acrylHome[data-skin="site"] .acrylHomeBrand { font-size: 12px; font-weight: 650; letter-spacing: .31em; text-transform: uppercase; }
2294
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; }
2295
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; }
2296
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; }
2297
2636
  .acrylHome[data-skin="site"] .acrylHomeBtn:hover:not(:disabled) { border-color: var(--h-text); background: transparent; color: var(--h-text); }