@acryldev/launcher-desktop 0.1.7 → 0.1.9

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/README.md CHANGED
@@ -8,6 +8,9 @@ The **ACRYL screen**: the first screen of the desktop app (and of the Web app),
8
8
  (`acryl-launcher`, the file `acryl apps` and the terminal read). Starting an app runs `npm run dev` in its folder, making one runs
9
9
  `npx -y acryl new <name> <starter>`, both with the machine's Node and npm and the saved model key (`acryl model`). Every process it
10
10
  started stops when the plugin unloads. Routes: `/api/acryl-launcher/{state,health,add,remove,new,start,stop}`.
11
+ - **Node** (`src/node.ts`, `@acryldev/launcher-desktop/node`): the same service wired to this machine (`createNodeLauncher(home)`), with
12
+ `readBlends` and `webboxesDeployUrl`. The Host plugin uses it, and so does the terminal Control Center (`acryl`, distribution/acryl-npm-launcher/tui), so
13
+ the window, the browser and the terminal run one implementation.
11
14
  - **Client** (`src/client/`): one entry in the frame's `shell.overlay` seat, a full-window layer over the workspace. "ACRYL ADE" in
12
15
  its list closes it; the small ACRYL button reopens it.
13
16
 
package/lib/client.js CHANGED
@@ -46,6 +46,20 @@ window.__ModuleLoader__.load({
46
46
  url.searchParams.set("name", name.toLowerCase().replace(/[^a-z0-9-]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, 40));
47
47
  return url.href;
48
48
  }
49
+ /**
50
+ * 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
51
+ * Create there). A community Blend that lives on GitHub rather than in the registry (`source` is `github:owner/repo#tag`) deploys from its
52
+ * repository, as a shared app does.
53
+ */
54
+ function webboxesDeployBlendUrl(blend) {
55
+ const name = (blend.id.split(".").pop() ?? blend.id).toLowerCase().replace(/[^a-z0-9-]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, 40);
56
+ const repository = /^github:([A-Za-z0-9][A-Za-z0-9-]*\/[A-Za-z0-9_.-]+)(?:#.*)?$/u.exec(blend.source ?? "");
57
+ if (repository?.[1] !== void 0) return webboxesDeployUrl(`https://github.com/${repository[1]}`, name);
58
+ const url = new URL(WEBBOXES_NEW_BOX);
59
+ url.searchParams.set("blend", blend.id);
60
+ url.searchParams.set("name", name);
61
+ return url.href;
62
+ }
49
63
  /** 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
64
  /** 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
65
  const WEBBOXES_NEW_BOX = "https://webboxes.ai/dashboard/webboxes";
@@ -433,6 +447,7 @@ window.__ModuleLoader__.load({
433
447
  view === "store" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StoreView, {
434
448
  api,
435
449
  state,
450
+ openExternal,
436
451
  onCreate: async (request) => {
437
452
  const done = await act(() => api.create(request));
438
453
  if (done) setView("apps");
@@ -1615,7 +1630,7 @@ window.__ModuleLoader__.load({
1615
1630
  });
1616
1631
  }
1617
1632
  /** 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 }) {
1633
+ function StoreView({ api, state, onCreate, openExternal }) {
1619
1634
  const [blends, setBlends] = (0, react.useState)(void 0);
1620
1635
  const [failed, setFailed] = (0, react.useState)(void 0);
1621
1636
  const [search, setSearch] = (0, react.useState)("");
@@ -1771,42 +1786,55 @@ window.__ModuleLoader__.load({
1771
1786
  }),
1772
1787
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1773
1788
  className: "acrylHomeCardFoot",
1774
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1775
- className: "acrylHomeRow",
1776
- 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"
1785
- }),
1786
- blend.publisher === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1787
- className: "acrylHomeMeta",
1788
- children: ["by @", blend.publisher]
1789
- }),
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
1797
- })
1798
- ]
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
- })]
1789
+ 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
+ }),
1826
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1827
+ type: "button",
1828
+ className: "acrylHomeBtn",
1829
+ "data-small": true,
1830
+ "data-primary": true,
1831
+ disabled: state === void 0,
1832
+ onClick: () => {
1833
+ setChosen(blend);
1834
+ },
1835
+ children: "Make an app"
1836
+ })
1837
+ ]
1810
1838
  })
1811
1839
  ]
1812
1840
  }, blend.id))
@@ -1918,7 +1946,7 @@ window.__ModuleLoader__.load({
1918
1946
  }),
1919
1947
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1920
1948
  className: "acrylHomeNote",
1921
- children: "Apps this screen started stop when ACRYL quits."
1949
+ children: "When ACRYL quits, the Web apps it started stop with it. A Desktop app keeps its window open; closing the window stops it."
1922
1950
  })
1923
1951
  ]
1924
1952
  });