@acryldev/launcher-desktop 0.1.0 → 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 +383 -134
- package/lib/client.js.map +1 -1
- package/lib/index.js +159 -13
- package/lib/index.js.map +1 -1
- package/lib/page.js +13 -13
- package/lib/types/client/api.d.ts +5 -1
- package/lib/types/contract.d.ts +40 -1
- package/lib/types/registry.d.ts +8 -3
- package/lib/types/service.d.ts +16 -1
- package/package.json +7 -7
package/lib/client.js
CHANGED
|
@@ -28,6 +28,10 @@ window.__ModuleLoader__.load({
|
|
|
28
28
|
const LAUNCHER_PUBLISH_PATH = `${LAUNCHER_API_PREFIX}/publish`;
|
|
29
29
|
const LAUNCHER_SHARE_PLAN_PATH = `${LAUNCHER_API_PREFIX}/share-plan`;
|
|
30
30
|
const LAUNCHER_SHARE_PATH = `${LAUNCHER_API_PREFIX}/share`;
|
|
31
|
+
const LAUNCHER_GITHUB_PATH = `${LAUNCHER_API_PREFIX}/github`;
|
|
32
|
+
const LAUNCHER_GITHUB_START_PATH = `${LAUNCHER_API_PREFIX}/github-start`;
|
|
33
|
+
const LAUNCHER_GITHUB_POLL_PATH = `${LAUNCHER_API_PREFIX}/github-poll`;
|
|
34
|
+
const LAUNCHER_GITHUB_DISCONNECT_PATH = `${LAUNCHER_API_PREFIX}/github-disconnect`;
|
|
31
35
|
const SURFACES = [
|
|
32
36
|
"web",
|
|
33
37
|
"desktop",
|
|
@@ -35,6 +39,16 @@ window.__ModuleLoader__.load({
|
|
|
35
39
|
];
|
|
36
40
|
/** Surfaces a person can choose for a new app today. */
|
|
37
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";
|
|
38
52
|
//#endregion
|
|
39
53
|
//#region src/client/api.ts
|
|
40
54
|
/** Same-origin browser client for the launcher routes (`../contract.ts`). */
|
|
@@ -98,6 +112,10 @@ window.__ModuleLoader__.load({
|
|
|
98
112
|
publishPlan: (request) => send(LAUNCHER_PUBLISH_PLAN_PATH, request),
|
|
99
113
|
publish: (request) => send(LAUNCHER_PUBLISH_PATH, request),
|
|
100
114
|
sharePlan: (request) => send(LAUNCHER_SHARE_PLAN_PATH, request),
|
|
115
|
+
github: () => send(LAUNCHER_GITHUB_PATH, {}),
|
|
116
|
+
githubStart: () => send(LAUNCHER_GITHUB_START_PATH, {}),
|
|
117
|
+
githubPoll: () => send(LAUNCHER_GITHUB_POLL_PATH, {}),
|
|
118
|
+
githubDisconnect: () => send(LAUNCHER_GITHUB_DISCONNECT_PATH, {}),
|
|
101
119
|
share: (request) => send(LAUNCHER_SHARE_PATH, request)
|
|
102
120
|
};
|
|
103
121
|
}
|
|
@@ -423,7 +441,7 @@ window.__ModuleLoader__.load({
|
|
|
423
441
|
}),
|
|
424
442
|
view === "cloud" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Empty, {
|
|
425
443
|
title: "On WebBoxes.ai",
|
|
426
|
-
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."
|
|
427
445
|
}),
|
|
428
446
|
view === "health" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HealthView, { api }),
|
|
429
447
|
view === "settings" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsView, {
|
|
@@ -777,8 +795,11 @@ window.__ModuleLoader__.load({
|
|
|
777
795
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
778
796
|
type: "button",
|
|
779
797
|
className: "acrylHomeBtn",
|
|
780
|
-
disabled:
|
|
781
|
-
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
|
+
},
|
|
782
803
|
children: "Deploy to WebBoxes.ai"
|
|
783
804
|
}),
|
|
784
805
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -854,11 +875,13 @@ window.__ModuleLoader__.load({
|
|
|
854
875
|
app,
|
|
855
876
|
onClose: () => {
|
|
856
877
|
setSharing(false);
|
|
857
|
-
}
|
|
878
|
+
},
|
|
879
|
+
openExternal
|
|
858
880
|
}, app.id) : null,
|
|
859
881
|
running ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PluginsPanel, {
|
|
860
882
|
api,
|
|
861
|
-
app
|
|
883
|
+
app,
|
|
884
|
+
openExternal
|
|
862
885
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
863
886
|
className: "acrylHomeNote",
|
|
864
887
|
children: "Start the app to pull plugins into it and share the ones made in it."
|
|
@@ -877,8 +900,139 @@ window.__ModuleLoader__.load({
|
|
|
877
900
|
}
|
|
878
901
|
/** Where a remote lives on the web, for a person to read: `https://github.com/me/shop.git` is `github.com/me/shop`. */
|
|
879
902
|
const remoteLabel = (remote) => remote.replace(/^https?:\/\//u, "").replace(/\.git$/u, "");
|
|
903
|
+
/**
|
|
904
|
+
* The GitHub connection sharing and publishing need: GitHub's device sign-in (a code the person types at github.com/login/device), so no terminal
|
|
905
|
+
* login is asked of anyone. Connected, it says who; apps started from then on get the connection.
|
|
906
|
+
*/
|
|
907
|
+
function GithubConnect({ api, openExternal }) {
|
|
908
|
+
const [github, setGithub] = (0, react.useState)(void 0);
|
|
909
|
+
const [code, setCode] = (0, react.useState)(void 0);
|
|
910
|
+
const [note, setNote] = (0, react.useState)(void 0);
|
|
911
|
+
const box = (0, react.useRef)(null);
|
|
912
|
+
(0, react.useEffect)(() => {
|
|
913
|
+
api.github().then(setGithub, (cause) => {
|
|
914
|
+
setNote(message(cause));
|
|
915
|
+
});
|
|
916
|
+
}, [api]);
|
|
917
|
+
(0, react.useEffect)(() => {
|
|
918
|
+
if (code !== void 0) box.current?.scrollIntoView?.({
|
|
919
|
+
block: "center",
|
|
920
|
+
behavior: "smooth"
|
|
921
|
+
});
|
|
922
|
+
}, [code]);
|
|
923
|
+
(0, react.useEffect)(() => {
|
|
924
|
+
if (code === void 0) return void 0;
|
|
925
|
+
let stop = false;
|
|
926
|
+
let wait = code.interval;
|
|
927
|
+
const tick = () => {
|
|
928
|
+
if (stop) return;
|
|
929
|
+
api.githubPoll().then((answer) => {
|
|
930
|
+
if (stop) return;
|
|
931
|
+
if (answer.state === "connected") {
|
|
932
|
+
setCode(void 0);
|
|
933
|
+
setGithub({
|
|
934
|
+
available: true,
|
|
935
|
+
login: answer.login
|
|
936
|
+
});
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
if (answer.state === "failed") {
|
|
940
|
+
setCode(void 0);
|
|
941
|
+
setNote(answer.reason);
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
if (answer.interval !== void 0) wait = answer.interval;
|
|
945
|
+
timer = setTimeout(tick, wait * 1e3);
|
|
946
|
+
}, () => {
|
|
947
|
+
if (!stop) timer = setTimeout(tick, wait * 1e3);
|
|
948
|
+
});
|
|
949
|
+
};
|
|
950
|
+
let timer = setTimeout(tick, wait * 1e3);
|
|
951
|
+
return () => {
|
|
952
|
+
stop = true;
|
|
953
|
+
clearTimeout(timer);
|
|
954
|
+
};
|
|
955
|
+
}, [api, code]);
|
|
956
|
+
if (github === void 0 || !github.available) return note === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
957
|
+
className: "acrylHomeNote",
|
|
958
|
+
"data-error": true,
|
|
959
|
+
role: "alert",
|
|
960
|
+
children: note
|
|
961
|
+
});
|
|
962
|
+
if (github.login !== null) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
963
|
+
className: "acrylHomeNote",
|
|
964
|
+
role: "status",
|
|
965
|
+
children: [
|
|
966
|
+
"GitHub: signed in as ",
|
|
967
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
968
|
+
className: "acrylHomeMeta",
|
|
969
|
+
children: github.login === "" ? "your account" : github.login
|
|
970
|
+
}),
|
|
971
|
+
".",
|
|
972
|
+
" ",
|
|
973
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
974
|
+
type: "button",
|
|
975
|
+
className: "acrylHomeBtn",
|
|
976
|
+
"data-small": true,
|
|
977
|
+
onClick: () => {
|
|
978
|
+
api.githubDisconnect().then(setGithub);
|
|
979
|
+
},
|
|
980
|
+
children: "Disconnect"
|
|
981
|
+
})
|
|
982
|
+
]
|
|
983
|
+
});
|
|
984
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
985
|
+
className: "acrylHomeNote",
|
|
986
|
+
role: "group",
|
|
987
|
+
"aria-label": "Connect GitHub",
|
|
988
|
+
ref: box,
|
|
989
|
+
children: [code === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: "Sharing sends the app to your own GitHub account. Connect it once on this computer." }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
990
|
+
type: "button",
|
|
991
|
+
className: "acrylHomeBtn",
|
|
992
|
+
"data-primary": true,
|
|
993
|
+
onClick: () => {
|
|
994
|
+
setNote(void 0);
|
|
995
|
+
api.githubStart().then((started) => {
|
|
996
|
+
setCode(started);
|
|
997
|
+
openExternal(started.verificationUri);
|
|
998
|
+
}, (cause) => {
|
|
999
|
+
setNote(message(cause));
|
|
1000
|
+
});
|
|
1001
|
+
},
|
|
1002
|
+
children: "Connect GitHub"
|
|
1003
|
+
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1004
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: "On the GitHub page that just opened, enter this code and approve ACRYL Control Center:" }),
|
|
1005
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1006
|
+
className: "acrylHomeName",
|
|
1007
|
+
"aria-label": "GitHub code",
|
|
1008
|
+
style: {
|
|
1009
|
+
fontSize: "1.6em",
|
|
1010
|
+
letterSpacing: "0.12em"
|
|
1011
|
+
},
|
|
1012
|
+
children: code.userCode
|
|
1013
|
+
}),
|
|
1014
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
|
|
1015
|
+
"The page did not open? Go to ",
|
|
1016
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
1017
|
+
href: code.verificationUri,
|
|
1018
|
+
onClick: (event) => {
|
|
1019
|
+
event.preventDefault();
|
|
1020
|
+
openExternal(code.verificationUri);
|
|
1021
|
+
},
|
|
1022
|
+
children: code.verificationUri
|
|
1023
|
+
}),
|
|
1024
|
+
". Waiting for your approval..."
|
|
1025
|
+
] })
|
|
1026
|
+
] }), note === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1027
|
+
className: "acrylHomeNote",
|
|
1028
|
+
"data-error": true,
|
|
1029
|
+
role: "alert",
|
|
1030
|
+
children: note
|
|
1031
|
+
})]
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
880
1034
|
/** Share a whole app: the app's own plan (which repository, how visible, what is saved first), then the person's yes. The app need not be running. */
|
|
881
|
-
function SharePanel({ api, app, onClose }) {
|
|
1035
|
+
function SharePanel({ api, app, onClose, openExternal }) {
|
|
882
1036
|
const [owner, setOwner] = (0, react.useState)("");
|
|
883
1037
|
const [plan, setPlan] = (0, react.useState)(void 0);
|
|
884
1038
|
const [done, setDone] = (0, react.useState)(void 0);
|
|
@@ -895,11 +1049,20 @@ window.__ModuleLoader__.load({
|
|
|
895
1049
|
setBusy(false);
|
|
896
1050
|
}
|
|
897
1051
|
};
|
|
1052
|
+
const [visibility, setVisibility] = (0, react.useState)("private");
|
|
1053
|
+
const panel = (0, react.useRef)(null);
|
|
1054
|
+
(0, react.useEffect)(() => {
|
|
1055
|
+
panel.current?.scrollIntoView?.({
|
|
1056
|
+
block: "nearest",
|
|
1057
|
+
behavior: "smooth"
|
|
1058
|
+
});
|
|
1059
|
+
}, []);
|
|
898
1060
|
const owner_ = owner.trim() === "" ? {} : { owner: owner.trim() };
|
|
899
1061
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
900
1062
|
className: "acrylHomePanel",
|
|
901
1063
|
role: "group",
|
|
902
1064
|
"aria-label": `Share ${app.name}`,
|
|
1065
|
+
ref: panel,
|
|
903
1066
|
children: [
|
|
904
1067
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
905
1068
|
className: "acrylHomePanelTop",
|
|
@@ -911,6 +1074,10 @@ window.__ModuleLoader__.load({
|
|
|
911
1074
|
children: "Close"
|
|
912
1075
|
})]
|
|
913
1076
|
}),
|
|
1077
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubConnect, {
|
|
1078
|
+
api,
|
|
1079
|
+
openExternal
|
|
1080
|
+
}),
|
|
914
1081
|
done !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
915
1082
|
className: "acrylHomeNote",
|
|
916
1083
|
role: "status",
|
|
@@ -934,26 +1101,45 @@ window.__ModuleLoader__.load({
|
|
|
934
1101
|
run(async () => {
|
|
935
1102
|
setPlan(await api.sharePlan({
|
|
936
1103
|
id: app.id,
|
|
937
|
-
...owner_
|
|
1104
|
+
...owner_,
|
|
1105
|
+
visibility
|
|
938
1106
|
}));
|
|
939
1107
|
});
|
|
940
1108
|
},
|
|
941
|
-
children: [
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1109
|
+
children: [
|
|
1110
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1111
|
+
className: "acrylHomeInput",
|
|
1112
|
+
style: { flex: "1 1 240px" },
|
|
1113
|
+
value: owner,
|
|
1114
|
+
placeholder: "GitHub account (blank: yours)",
|
|
1115
|
+
"aria-label": "GitHub account",
|
|
1116
|
+
onChange: (event) => {
|
|
1117
|
+
setOwner(event.target.value);
|
|
1118
|
+
}
|
|
1119
|
+
}),
|
|
1120
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
1121
|
+
className: "acrylHomeInput",
|
|
1122
|
+
value: visibility,
|
|
1123
|
+
"aria-label": "Who can see it",
|
|
1124
|
+
onChange: (event) => {
|
|
1125
|
+
setVisibility(event.target.value === "public" ? "public" : "private");
|
|
1126
|
+
},
|
|
1127
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1128
|
+
value: "private",
|
|
1129
|
+
children: "Private: only you and people you invite"
|
|
1130
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1131
|
+
value: "public",
|
|
1132
|
+
children: "Public: anyone, listed as Community"
|
|
1133
|
+
})]
|
|
1134
|
+
}),
|
|
1135
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1136
|
+
type: "submit",
|
|
1137
|
+
className: "acrylHomeBtn",
|
|
1138
|
+
"data-primary": true,
|
|
1139
|
+
disabled: busy,
|
|
1140
|
+
children: "Review what would be sent"
|
|
1141
|
+
})
|
|
1142
|
+
]
|
|
957
1143
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
958
1144
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", {
|
|
959
1145
|
className: "acrylHomeKv",
|
|
@@ -1008,7 +1194,7 @@ window.__ModuleLoader__.load({
|
|
|
1008
1194
|
});
|
|
1009
1195
|
}
|
|
1010
1196
|
/** The plugins of a running app: what it has, pulling one from a registry, and sharing one made here (the app's plan, then the person's yes). */
|
|
1011
|
-
function PluginsPanel({ api, app }) {
|
|
1197
|
+
function PluginsPanel({ api, app, openExternal }) {
|
|
1012
1198
|
const [plugins, setPlugins] = (0, react.useState)(void 0);
|
|
1013
1199
|
const [source, setSource] = (0, react.useState)("");
|
|
1014
1200
|
const [sharing, setSharing] = (0, react.useState)(void 0);
|
|
@@ -1144,122 +1330,129 @@ window.__ModuleLoader__.load({
|
|
|
1144
1330
|
className: "acrylHomePanel",
|
|
1145
1331
|
role: "group",
|
|
1146
1332
|
"aria-label": `Share ${sharing}`,
|
|
1147
|
-
children: [
|
|
1148
|
-
className: "acrylHomePanelTop",
|
|
1149
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", { children: ["Share ", sharing] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1150
|
-
type: "button",
|
|
1151
|
-
className: "acrylHomeBtn",
|
|
1152
|
-
"data-small": true,
|
|
1153
|
-
onClick: () => {
|
|
1154
|
-
setSharing(void 0);
|
|
1155
|
-
setPlan(void 0);
|
|
1156
|
-
setDone(void 0);
|
|
1157
|
-
},
|
|
1158
|
-
children: "Close"
|
|
1159
|
-
})]
|
|
1160
|
-
}), done !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1161
|
-
className: "acrylHomeNote",
|
|
1162
|
-
children: ["Published: ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1163
|
-
className: "acrylHomeMeta",
|
|
1164
|
-
children: done.releaseUrl
|
|
1165
|
-
})]
|
|
1166
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1167
|
-
className: "acrylHomeNote",
|
|
1168
|
-
children: ["A friend gets exactly these bytes with ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1169
|
-
className: "acrylHomeMeta",
|
|
1170
|
-
children: done.pullLine
|
|
1171
|
-
})]
|
|
1172
|
-
})] }) : plan === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
1173
|
-
className: "acrylHomeRow",
|
|
1174
|
-
onSubmit: (event) => {
|
|
1175
|
-
event.preventDefault();
|
|
1176
|
-
run(`Reading what publishing ${sharing} would send...`, async () => {
|
|
1177
|
-
setPlan(await api.publishPlan({
|
|
1178
|
-
id: app.id,
|
|
1179
|
-
plugin: sharing,
|
|
1180
|
-
...owner_
|
|
1181
|
-
}));
|
|
1182
|
-
});
|
|
1183
|
-
},
|
|
1184
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1185
|
-
className: "acrylHomeInput",
|
|
1186
|
-
style: { flex: "1 1 240px" },
|
|
1187
|
-
value: owner,
|
|
1188
|
-
placeholder: "GitHub account (blank: yours)",
|
|
1189
|
-
"aria-label": "GitHub account",
|
|
1190
|
-
onChange: (event) => {
|
|
1191
|
-
setOwner(event.target.value);
|
|
1192
|
-
}
|
|
1193
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1194
|
-
type: "submit",
|
|
1195
|
-
className: "acrylHomeBtn",
|
|
1196
|
-
"data-primary": true,
|
|
1197
|
-
disabled: busy,
|
|
1198
|
-
children: "Review what would be sent"
|
|
1199
|
-
})]
|
|
1200
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1201
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", {
|
|
1202
|
-
className: "acrylHomeKv",
|
|
1203
|
-
children: [
|
|
1204
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: "Repository" }),
|
|
1205
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", { children: [
|
|
1206
|
-
plan.owner,
|
|
1207
|
-
"/",
|
|
1208
|
-
plan.repo,
|
|
1209
|
-
plan.createsRepository ? " (a new repository)" : ""
|
|
1210
|
-
] }),
|
|
1211
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: "Version" }),
|
|
1212
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", { children: [
|
|
1213
|
-
plan.version,
|
|
1214
|
-
" · ",
|
|
1215
|
-
plan.visibility,
|
|
1216
|
-
" · ",
|
|
1217
|
-
plan.license
|
|
1218
|
-
] }),
|
|
1219
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: "Files" }),
|
|
1220
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: plan.files.join(", ") }),
|
|
1221
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: "A friend pulls it with" }),
|
|
1222
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: plan.pullLine })
|
|
1223
|
-
]
|
|
1224
|
-
}),
|
|
1225
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1226
|
-
className: "acrylHomeNote",
|
|
1227
|
-
children: "Nothing has been sent. It is sent only when you say yes."
|
|
1228
|
-
}),
|
|
1333
|
+
children: [
|
|
1229
1334
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1230
|
-
className: "
|
|
1231
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1335
|
+
className: "acrylHomePanelTop",
|
|
1336
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", { children: ["Share ", sharing] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1232
1337
|
type: "button",
|
|
1233
1338
|
className: "acrylHomeBtn",
|
|
1234
|
-
"data-
|
|
1235
|
-
disabled: busy,
|
|
1339
|
+
"data-small": true,
|
|
1236
1340
|
onClick: () => {
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
plugin: sharing,
|
|
1241
|
-
...owner_,
|
|
1242
|
-
plan
|
|
1243
|
-
}));
|
|
1244
|
-
});
|
|
1341
|
+
setSharing(void 0);
|
|
1342
|
+
setPlan(void 0);
|
|
1343
|
+
setDone(void 0);
|
|
1245
1344
|
},
|
|
1246
|
-
children:
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1345
|
+
children: "Close"
|
|
1346
|
+
})]
|
|
1347
|
+
}),
|
|
1348
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubConnect, {
|
|
1349
|
+
api,
|
|
1350
|
+
openExternal
|
|
1351
|
+
}),
|
|
1352
|
+
done !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1353
|
+
className: "acrylHomeNote",
|
|
1354
|
+
children: ["Published: ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1355
|
+
className: "acrylHomeMeta",
|
|
1356
|
+
children: done.releaseUrl
|
|
1357
|
+
})]
|
|
1358
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1359
|
+
className: "acrylHomeNote",
|
|
1360
|
+
children: ["A friend gets exactly these bytes with ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1361
|
+
className: "acrylHomeMeta",
|
|
1362
|
+
children: done.pullLine
|
|
1363
|
+
})]
|
|
1364
|
+
})] }) : plan === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
1365
|
+
className: "acrylHomeRow",
|
|
1366
|
+
onSubmit: (event) => {
|
|
1367
|
+
event.preventDefault();
|
|
1368
|
+
run(`Reading what publishing ${sharing} would send...`, async () => {
|
|
1369
|
+
setPlan(await api.publishPlan({
|
|
1370
|
+
id: app.id,
|
|
1371
|
+
plugin: sharing,
|
|
1372
|
+
...owner_
|
|
1373
|
+
}));
|
|
1374
|
+
});
|
|
1375
|
+
},
|
|
1376
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1377
|
+
className: "acrylHomeInput",
|
|
1378
|
+
style: { flex: "1 1 240px" },
|
|
1379
|
+
value: owner,
|
|
1380
|
+
placeholder: "GitHub account (blank: yours)",
|
|
1381
|
+
"aria-label": "GitHub account",
|
|
1382
|
+
onChange: (event) => {
|
|
1383
|
+
setOwner(event.target.value);
|
|
1384
|
+
}
|
|
1252
1385
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1253
|
-
type: "
|
|
1386
|
+
type: "submit",
|
|
1254
1387
|
className: "acrylHomeBtn",
|
|
1388
|
+
"data-primary": true,
|
|
1255
1389
|
disabled: busy,
|
|
1256
|
-
|
|
1257
|
-
setPlan(void 0);
|
|
1258
|
-
},
|
|
1259
|
-
children: "Not yet"
|
|
1390
|
+
children: "Review what would be sent"
|
|
1260
1391
|
})]
|
|
1261
|
-
})
|
|
1262
|
-
|
|
1392
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1393
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", {
|
|
1394
|
+
className: "acrylHomeKv",
|
|
1395
|
+
children: [
|
|
1396
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: "Repository" }),
|
|
1397
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", { children: [
|
|
1398
|
+
plan.owner,
|
|
1399
|
+
"/",
|
|
1400
|
+
plan.repo,
|
|
1401
|
+
plan.createsRepository ? " (a new repository)" : ""
|
|
1402
|
+
] }),
|
|
1403
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: "Version" }),
|
|
1404
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", { children: [
|
|
1405
|
+
plan.version,
|
|
1406
|
+
" · ",
|
|
1407
|
+
plan.visibility,
|
|
1408
|
+
" · ",
|
|
1409
|
+
plan.license
|
|
1410
|
+
] }),
|
|
1411
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: "Files" }),
|
|
1412
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: plan.files.join(", ") }),
|
|
1413
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: "A friend pulls it with" }),
|
|
1414
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: plan.pullLine })
|
|
1415
|
+
]
|
|
1416
|
+
}),
|
|
1417
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1418
|
+
className: "acrylHomeNote",
|
|
1419
|
+
children: "Nothing has been sent. It is sent only when you say yes."
|
|
1420
|
+
}),
|
|
1421
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1422
|
+
className: "acrylHomeActs",
|
|
1423
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1424
|
+
type: "button",
|
|
1425
|
+
className: "acrylHomeBtn",
|
|
1426
|
+
"data-primary": true,
|
|
1427
|
+
disabled: busy,
|
|
1428
|
+
onClick: () => {
|
|
1429
|
+
run(`Publishing ${plan.owner}/${plan.repo} ${plan.version}: ${plan.createsRepository ? "making the repository, " : ""}pushing the files and making the release...`, async () => {
|
|
1430
|
+
setDone(await api.publish({
|
|
1431
|
+
id: app.id,
|
|
1432
|
+
plugin: sharing,
|
|
1433
|
+
...owner_,
|
|
1434
|
+
plan
|
|
1435
|
+
}));
|
|
1436
|
+
});
|
|
1437
|
+
},
|
|
1438
|
+
children: [
|
|
1439
|
+
"Yes, publish ",
|
|
1440
|
+
plan.owner,
|
|
1441
|
+
"/",
|
|
1442
|
+
plan.repo
|
|
1443
|
+
]
|
|
1444
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1445
|
+
type: "button",
|
|
1446
|
+
className: "acrylHomeBtn",
|
|
1447
|
+
disabled: busy,
|
|
1448
|
+
onClick: () => {
|
|
1449
|
+
setPlan(void 0);
|
|
1450
|
+
},
|
|
1451
|
+
children: "Not yet"
|
|
1452
|
+
})]
|
|
1453
|
+
})
|
|
1454
|
+
] })
|
|
1455
|
+
]
|
|
1263
1456
|
}),
|
|
1264
1457
|
doing === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1265
1458
|
className: "acrylHomeNote",
|
|
@@ -1281,7 +1474,7 @@ window.__ModuleLoader__.load({
|
|
|
1281
1474
|
const [starter, setStarter] = (0, react.useState)(state.starters[0]?.value ?? "blank");
|
|
1282
1475
|
const [surface, setSurface] = (0, react.useState)("web");
|
|
1283
1476
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
1284
|
-
const line = `cd ${where} && acryl new ${name === "" ? "<name>" : name} ${blend === void 0 ? starter : `--from ${blend.id}`}`;
|
|
1477
|
+
const line = `cd ${where} && acryl new ${name === "" ? "<name>" : name} ${blend === void 0 ? starter : `--from ${blend.source ?? blend.id}`}`;
|
|
1285
1478
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
1286
1479
|
className: "acrylHomePanel acrylHomeForm",
|
|
1287
1480
|
onSubmit: (event) => {
|
|
@@ -1291,7 +1484,7 @@ window.__ModuleLoader__.load({
|
|
|
1291
1484
|
where,
|
|
1292
1485
|
name,
|
|
1293
1486
|
surface,
|
|
1294
|
-
...blend === void 0 ? { starter } : { blend: blend.id }
|
|
1487
|
+
...blend === void 0 ? { starter } : { blend: blend.source ?? blend.id }
|
|
1295
1488
|
}).finally(() => {
|
|
1296
1489
|
setBusy(false);
|
|
1297
1490
|
});
|
|
@@ -1326,6 +1519,16 @@ window.__ModuleLoader__.load({
|
|
|
1326
1519
|
"aria-label": "Name"
|
|
1327
1520
|
})]
|
|
1328
1521
|
}),
|
|
1522
|
+
blend !== void 0 && blend.origin === "community" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1523
|
+
className: "acrylHomeNote",
|
|
1524
|
+
"data-warn": true,
|
|
1525
|
+
role: "note",
|
|
1526
|
+
children: [
|
|
1527
|
+
"A Community Blend: released by someone outside the ACRYL project, from ",
|
|
1528
|
+
blend.source,
|
|
1529
|
+
". Its code is not reviewed; make it only if you trust who released it."
|
|
1530
|
+
]
|
|
1531
|
+
}) : null,
|
|
1329
1532
|
blend !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1330
1533
|
className: "acrylHomeNote",
|
|
1331
1534
|
children: blend.description
|
|
@@ -1416,6 +1619,7 @@ window.__ModuleLoader__.load({
|
|
|
1416
1619
|
const [blends, setBlends] = (0, react.useState)(void 0);
|
|
1417
1620
|
const [failed, setFailed] = (0, react.useState)(void 0);
|
|
1418
1621
|
const [search, setSearch] = (0, react.useState)("");
|
|
1622
|
+
const [origin, setOrigin] = (0, react.useState)("all");
|
|
1419
1623
|
const [chosen, setChosen] = (0, react.useState)(void 0);
|
|
1420
1624
|
const [attempt, setAttempt] = (0, react.useState)(0);
|
|
1421
1625
|
(0, react.useEffect)(() => {
|
|
@@ -1431,7 +1635,8 @@ window.__ModuleLoader__.load({
|
|
|
1431
1635
|
};
|
|
1432
1636
|
}, [api, attempt]);
|
|
1433
1637
|
const needle = search.trim().toLowerCase();
|
|
1434
|
-
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;
|
|
1435
1640
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1436
1641
|
className: "acrylHomeForm",
|
|
1437
1642
|
children: [
|
|
@@ -1468,6 +1673,50 @@ window.__ModuleLoader__.load({
|
|
|
1468
1673
|
setSearch(event.target.value);
|
|
1469
1674
|
}
|
|
1470
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
|
+
}),
|
|
1471
1720
|
failed !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1472
1721
|
className: "acrylHomeNote",
|
|
1473
1722
|
"data-error": true,
|