@acryldev/launcher-desktop 0.1.2 → 0.1.3
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 +63 -4
- package/lib/client.js.map +1 -1
- package/lib/index.js +14 -3
- package/lib/index.js.map +1 -1
- package/lib/page.js +12 -12
- package/lib/types/contract.d.ts +6 -0
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -39,6 +39,16 @@ window.__ModuleLoader__.load({
|
|
|
39
39
|
];
|
|
40
40
|
/** Surfaces a person can choose for a new app today. */
|
|
41
41
|
const MAKEABLE_SURFACES = ["web", "desktop"];
|
|
42
|
+
/** WebBoxes.ai's New WebBox form, opened with the app's repository filled in (the person signs in and presses Create there). */
|
|
43
|
+
function webboxesDeployUrl(github, name) {
|
|
44
|
+
const url = new URL(WEBBOXES_NEW_BOX);
|
|
45
|
+
url.searchParams.set("github", github);
|
|
46
|
+
url.searchParams.set("name", name.toLowerCase().replace(/[^a-z0-9-]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, 40));
|
|
47
|
+
return url.href;
|
|
48
|
+
}
|
|
49
|
+
/** 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
|
+
/** The New WebBox page of webboxes.ai, which takes `github` and `name` to fill its form. */
|
|
51
|
+
const WEBBOXES_NEW_BOX = "https://webboxes.ai/dashboard/webboxes/new";
|
|
42
52
|
//#endregion
|
|
43
53
|
//#region src/client/api.ts
|
|
44
54
|
/** Same-origin browser client for the launcher routes (`../contract.ts`). */
|
|
@@ -431,7 +441,7 @@ window.__ModuleLoader__.load({
|
|
|
431
441
|
}),
|
|
432
442
|
view === "cloud" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Empty, {
|
|
433
443
|
title: "On WebBoxes.ai",
|
|
434
|
-
text: "
|
|
444
|
+
text: "Put an app online at <name>.webboxes.ai: Share it to GitHub as Public (its card, Share), then press Deploy to WebBoxes.ai on its card. WebBoxes.ai opens with the app filled in: sign in, press Create, then Publish."
|
|
435
445
|
}),
|
|
436
446
|
view === "health" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HealthView, { api }),
|
|
437
447
|
view === "settings" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsView, {
|
|
@@ -785,8 +795,11 @@ window.__ModuleLoader__.load({
|
|
|
785
795
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
786
796
|
type: "button",
|
|
787
797
|
className: "acrylHomeBtn",
|
|
788
|
-
disabled:
|
|
789
|
-
title: "
|
|
798
|
+
disabled: app.github === void 0,
|
|
799
|
+
title: app.github === void 0 ? "Share the app to GitHub first (Public), then deploy it from there" : `Opens WebBoxes.ai with ${app.github} filled in`,
|
|
800
|
+
onClick: () => {
|
|
801
|
+
if (app.github !== void 0) openExternal(webboxesDeployUrl(app.github, app.name));
|
|
802
|
+
},
|
|
790
803
|
children: "Deploy to WebBoxes.ai"
|
|
791
804
|
}),
|
|
792
805
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -1606,6 +1619,7 @@ window.__ModuleLoader__.load({
|
|
|
1606
1619
|
const [blends, setBlends] = (0, react.useState)(void 0);
|
|
1607
1620
|
const [failed, setFailed] = (0, react.useState)(void 0);
|
|
1608
1621
|
const [search, setSearch] = (0, react.useState)("");
|
|
1622
|
+
const [origin, setOrigin] = (0, react.useState)("all");
|
|
1609
1623
|
const [chosen, setChosen] = (0, react.useState)(void 0);
|
|
1610
1624
|
const [attempt, setAttempt] = (0, react.useState)(0);
|
|
1611
1625
|
(0, react.useEffect)(() => {
|
|
@@ -1621,7 +1635,8 @@ window.__ModuleLoader__.load({
|
|
|
1621
1635
|
};
|
|
1622
1636
|
}, [api, attempt]);
|
|
1623
1637
|
const needle = search.trim().toLowerCase();
|
|
1624
|
-
const shown = (blends ?? []).filter((blend) => needle === "" || `${blend.name} ${blend.id} ${blend.category} ${blend.description}`.toLowerCase().includes(needle));
|
|
1638
|
+
const shown = (blends ?? []).filter((blend) => (origin === "all" || blend.origin === origin) && (needle === "" || `${blend.name} ${blend.id} ${blend.category} ${blend.description}`.toLowerCase().includes(needle)));
|
|
1639
|
+
const count = (which) => (blends ?? []).filter((blend) => blend.origin === which).length;
|
|
1625
1640
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1626
1641
|
className: "acrylHomeForm",
|
|
1627
1642
|
children: [
|
|
@@ -1658,6 +1673,50 @@ window.__ModuleLoader__.load({
|
|
|
1658
1673
|
setSearch(event.target.value);
|
|
1659
1674
|
}
|
|
1660
1675
|
}),
|
|
1676
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1677
|
+
className: "acrylHomeRow",
|
|
1678
|
+
role: "group",
|
|
1679
|
+
"aria-label": "Who released it",
|
|
1680
|
+
children: [
|
|
1681
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1682
|
+
type: "button",
|
|
1683
|
+
className: "acrylHomeChip",
|
|
1684
|
+
"aria-pressed": origin === "all",
|
|
1685
|
+
onClick: () => {
|
|
1686
|
+
setOrigin("all");
|
|
1687
|
+
},
|
|
1688
|
+
children: "All"
|
|
1689
|
+
}),
|
|
1690
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1691
|
+
type: "button",
|
|
1692
|
+
className: "acrylHomeChip",
|
|
1693
|
+
"aria-pressed": origin === "official",
|
|
1694
|
+
title: "Released by the ACRYL project",
|
|
1695
|
+
onClick: () => {
|
|
1696
|
+
setOrigin("official");
|
|
1697
|
+
},
|
|
1698
|
+
children: [
|
|
1699
|
+
"Official (",
|
|
1700
|
+
count("official"),
|
|
1701
|
+
")"
|
|
1702
|
+
]
|
|
1703
|
+
}),
|
|
1704
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1705
|
+
type: "button",
|
|
1706
|
+
className: "acrylHomeChip",
|
|
1707
|
+
"aria-pressed": origin === "community",
|
|
1708
|
+
title: "Released by people outside the ACRYL project; their code is not reviewed",
|
|
1709
|
+
onClick: () => {
|
|
1710
|
+
setOrigin("community");
|
|
1711
|
+
},
|
|
1712
|
+
children: [
|
|
1713
|
+
"Community (",
|
|
1714
|
+
count("community"),
|
|
1715
|
+
")"
|
|
1716
|
+
]
|
|
1717
|
+
})
|
|
1718
|
+
]
|
|
1719
|
+
}),
|
|
1661
1720
|
failed !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1662
1721
|
className: "acrylHomeNote",
|
|
1663
1722
|
"data-error": true,
|