@acryldev/blends-frame 0.2.10 → 0.2.12
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 +43 -10
- package/lib/client.js.map +1 -1
- package/lib/contract.d.ts +8 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +93 -5
- package/lib/index.js.map +1 -1
- package/lib/npm-share.d.ts +45 -0
- package/lib/registry.d.ts +4 -0
- package/lib/types/client/plugins-navigator.d.ts +3 -1
- package/lib/types/contract.d.ts +8 -0
- package/package.json +3 -3
package/lib/client.js
CHANGED
|
@@ -237,13 +237,19 @@ window.__ModuleLoader__.load({
|
|
|
237
237
|
/** @throws when the value is not a share plan. */
|
|
238
238
|
function parseSharePlan(value) {
|
|
239
239
|
if (!isRecord$5(value)) throw new Error("share plan: not a plan");
|
|
240
|
-
const { owner, repo, version, visibility, createsRepository, released, license, registry, placement } = value;
|
|
240
|
+
const { owner, repo, version, visibility, createsRepository, released, license, registry, placement, npm } = value;
|
|
241
241
|
if (typeof owner !== "string" || !GITHUB_NAME.test(owner) || typeof repo !== "string" || !GITHUB_NAME.test(repo)) throw new Error("share plan: repository");
|
|
242
242
|
if (typeof version !== "string" || version === "" || released !== void 0 && (typeof released !== "string" || released === "")) throw new Error("share plan: version");
|
|
243
243
|
if (visibility !== "private" && visibility !== "public" || typeof createsRepository !== "boolean") throw new Error("share plan: visibility");
|
|
244
244
|
if (license !== void 0 && (typeof license !== "string" || !/^[A-Za-z0-9.+-]+$/u.test(license))) throw new Error("share plan: license");
|
|
245
245
|
if (registry !== void 0 && typeof registry !== "boolean") throw new Error("share plan: registry");
|
|
246
246
|
if (registry === true && visibility !== "public") throw new Error("share plan: only a public share can be listed in the registry");
|
|
247
|
+
const onNpm = npm === void 0 ? void 0 : isRecord$5(npm) && typeof npm.package === "string" && npm.package !== "" && typeof npm.registry === "string" && /^https?:\/\//u.test(npm.registry) && typeof npm.digest === "string" && /^[0-9a-f]{64}$/u.test(npm.digest) ? {
|
|
248
|
+
package: npm.package,
|
|
249
|
+
registry: npm.registry,
|
|
250
|
+
digest: npm.digest
|
|
251
|
+
} : null;
|
|
252
|
+
if (onNpm === null) throw new Error("share plan: npm");
|
|
247
253
|
const place = placement === void 0 ? void 0 : isRecord$5(placement) && typeof placement.category === "string" && (placement.subcategory === void 0 || typeof placement.subcategory === "string") ? {
|
|
248
254
|
category: placement.category,
|
|
249
255
|
...typeof placement.subcategory === "string" ? { subcategory: placement.subcategory } : {}
|
|
@@ -258,6 +264,7 @@ window.__ModuleLoader__.load({
|
|
|
258
264
|
...released === void 0 ? {} : { released },
|
|
259
265
|
...license === void 0 ? {} : { license },
|
|
260
266
|
...registry === true ? { registry } : {},
|
|
267
|
+
...onNpm === void 0 ? {} : { npm: onNpm },
|
|
261
268
|
...place === void 0 ? {} : { placement: place }
|
|
262
269
|
};
|
|
263
270
|
}
|
|
@@ -424,7 +431,7 @@ window.__ModuleLoader__.load({
|
|
|
424
431
|
status: "ready",
|
|
425
432
|
entries: value.entries.map((entry) => {
|
|
426
433
|
if (!isRecord$5(entry)) throw new Error("registry: entry");
|
|
427
|
-
const { name, description, owner, url, version, published, compatibility, origin, source, installed, mine, download } = entry;
|
|
434
|
+
const { name, description, owner, url, version, published, compatibility, origin, source, installed, mine, updateFrom, download } = entry;
|
|
428
435
|
if (typeof name !== "string" || typeof description !== "string" || typeof owner !== "string" || typeof url !== "string" || typeof version !== "string" || typeof compatibility !== "string" || typeof source !== "string" || typeof installed !== "boolean" || typeof mine !== "boolean") throw new Error("registry: entry");
|
|
429
436
|
return {
|
|
430
437
|
name,
|
|
@@ -438,6 +445,7 @@ window.__ModuleLoader__.load({
|
|
|
438
445
|
source,
|
|
439
446
|
installed,
|
|
440
447
|
mine,
|
|
448
|
+
...typeof updateFrom === "string" ? { updateFrom } : {},
|
|
441
449
|
...typeof download === "number" && download > 0 ? { download } : {}
|
|
442
450
|
};
|
|
443
451
|
}),
|
|
@@ -17596,9 +17604,13 @@ window.__ModuleLoader__.load({
|
|
|
17596
17604
|
*/
|
|
17597
17605
|
/** The command another app runs to take a shared plugin, from its repository address and version. */
|
|
17598
17606
|
function pullCommand(shared) {
|
|
17607
|
+
const onNpm = /^https:\/\/www\.npmjs\.com\/package\/(.+)$/u.exec(shared.url);
|
|
17608
|
+
if (onNpm !== null) return `npm run acryl -- plugin pull npm:${onNpm[1] ?? ""}@${shared.version}`;
|
|
17599
17609
|
const where = /^https:\/\/github\.com\/([^/]+)\/([^/#?]+)/u.exec(shared.url);
|
|
17600
17610
|
return where === null ? void 0 : `npm run acryl -- plugin pull github:${where[1] ?? ""}/${where[2] ?? ""}@${shared.version}`;
|
|
17601
17611
|
}
|
|
17612
|
+
/** Where a share went, in words: npm or GitHub. */
|
|
17613
|
+
const sharedOn = (shared) => /^https:\/\/www\.npmjs\.com\//u.test(shared.url) ? "npm" : "GitHub";
|
|
17602
17614
|
/** What to send a colleague so they can add a shared plugin: the address the Registry tab's "Add by address" takes. */
|
|
17603
17615
|
function colleagueAddress(shared) {
|
|
17604
17616
|
const where = /^https:\/\/github\.com\/([^/]+)\/([^/#?]+)/u.exec(shared.url);
|
|
@@ -17610,16 +17622,22 @@ window.__ModuleLoader__.load({
|
|
|
17610
17622
|
*/
|
|
17611
17623
|
function shareQuestion(plan) {
|
|
17612
17624
|
const name = plan.repo;
|
|
17625
|
+
if (plan.npm !== void 0) {
|
|
17626
|
+
const sent = plan.released === void 0 ? "" : ` This sends version ${plan.version}, because ${plan.released} was already published.`;
|
|
17627
|
+
return `Publish ${plan.repo} to npm as ${plan.npm.package}? Anyone can find it there and add it to their own app. It is published with your own npm login.${sent}`;
|
|
17628
|
+
}
|
|
17613
17629
|
const who = plan.registry === true ? `List ${name} in the public registry? Anyone can search for it and add it with one click.` : plan.visibility === "public" ? `Share ${name} with everyone? Anyone can find it and add it to their own app.` : `Share ${name} with your team? Only people you invite can add it.`;
|
|
17614
17630
|
const next = plan.released === void 0 ? "" : ` This sends version ${plan.version}, because ${plan.released} was already shared.`;
|
|
17615
17631
|
return `${who} It is kept on your GitHub account, ${plan.owner}.${next}`;
|
|
17616
17632
|
}
|
|
17617
17633
|
/** The words on the one big button that confirms a share. */
|
|
17618
17634
|
function shareButton(plan) {
|
|
17635
|
+
if (plan.npm !== void 0) return "Publish to npm";
|
|
17619
17636
|
return plan.registry === true ? "List in the registry" : plan.visibility === "public" ? "Share with everyone" : "Share with my team";
|
|
17620
17637
|
}
|
|
17621
17638
|
/** The exact sentence of what a share does, for the "Details" of the confirmation: the repository, whether it is created, the version and who can see it. */
|
|
17622
17639
|
function shareSentence(plan) {
|
|
17640
|
+
if (plan.npm !== void 0) return `Publish v${plan.version} of ${plan.repo} to ${plan.npm.registry} as ${plan.npm.package}, public, under the ${plan.license ?? "MIT"} license. It is sent with your own npm login (npm whoami).${plan.released === void 0 ? "" : ` v${plan.released} is already there, so this is the next version.`}`;
|
|
17623
17641
|
const where = `${plan.owner}/${plan.repo}`;
|
|
17624
17642
|
return `${plan.createsRepository ? `Create repository ${where} on GitHub and publish v${plan.version}?` : `Publish v${plan.version} to ${where} on GitHub?`}${plan.released === void 0 ? "" : ` v${plan.released} is released there, so this is the next version.`} It will be ${plan.visibility === "public" ? `public, under the ${plan.license ?? "MIT"} license: anyone can read it and pull it into their own app` : "private"}.${plan.registry === true ? " It will be listed in the public Cordis plugin registry." : ""}`;
|
|
17625
17643
|
}
|
|
@@ -17627,7 +17645,7 @@ window.__ModuleLoader__.load({
|
|
|
17627
17645
|
function shareDetails(plan) {
|
|
17628
17646
|
return [
|
|
17629
17647
|
shareSentence(plan),
|
|
17630
|
-
`Repository: ${plan.owner}/${plan.repo} on GitHub (${plan.createsRepository ? "a new one" : "it exists"}), ${plan.visibility}
|
|
17648
|
+
...plan.npm === void 0 ? [`Repository: ${plan.owner}/${plan.repo} on GitHub (${plan.createsRepository ? "a new one" : "it exists"}), ${plan.visibility}`] : [`Package: ${plan.npm.package} on ${plan.npm.registry}`],
|
|
17631
17649
|
...plan.license === void 0 ? [] : [`License: ${plan.license}`],
|
|
17632
17650
|
...plan.registry === true ? ["Topic: cordis-plugin, which cordisplugins.github.io lists within about an hour"] : [],
|
|
17633
17651
|
...plan.placement === void 0 ? [] : [`Category: ${plan.placement.category}${plan.placement.subcategory === void 0 ? "" : ` › ${plan.placement.subcategory}`}, where this app is in the Blends store`]
|
|
@@ -17734,6 +17752,9 @@ window.__ModuleLoader__.load({
|
|
|
17734
17752
|
...target === void 0 ? { name } : target === "registry" ? {
|
|
17735
17753
|
name,
|
|
17736
17754
|
registry: true
|
|
17755
|
+
} : target === "npm" ? {
|
|
17756
|
+
name,
|
|
17757
|
+
npm: true
|
|
17737
17758
|
} : {
|
|
17738
17759
|
name,
|
|
17739
17760
|
visibility: target
|
|
@@ -47362,7 +47383,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47362
47383
|
className: "acrylBlendsShareAsk",
|
|
47363
47384
|
role: "alertdialog",
|
|
47364
47385
|
"aria-label": `Add ${item.name}`,
|
|
47365
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: addQuestion(item.name, item.owner, item.download, item.origin) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
47386
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: item.updateFrom === void 0 ? addQuestion(item.name, item.owner, item.download, item.origin) : `Update ${item.name} from v${item.updateFrom}? Changes you made to its folder are kept; if the new release changes the same lines, nothing is changed and it says which file.` }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
47366
47387
|
className: "acrylBlendsShareRow",
|
|
47367
47388
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
47368
47389
|
type: "button",
|
|
@@ -47378,7 +47399,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47378
47399
|
onClick: () => {
|
|
47379
47400
|
add(item.source);
|
|
47380
47401
|
},
|
|
47381
|
-
children: "Add to my app"
|
|
47402
|
+
children: item.updateFrom === void 0 ? "Add to my app" : "Update"
|
|
47382
47403
|
})]
|
|
47383
47404
|
})]
|
|
47384
47405
|
});
|
|
@@ -47408,7 +47429,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47408
47429
|
title: "Made for another kind of app; it may not run in this one",
|
|
47409
47430
|
children: "other apps"
|
|
47410
47431
|
}),
|
|
47411
|
-
entry.installed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
47432
|
+
entry.installed && entry.updateFrom === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
47412
47433
|
className: "acrylBlendsRegAdded",
|
|
47413
47434
|
role: "status",
|
|
47414
47435
|
children: "Added"
|
|
@@ -47423,10 +47444,11 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47423
47444
|
name: entry.name,
|
|
47424
47445
|
owner: entry.owner,
|
|
47425
47446
|
origin: entry.origin,
|
|
47447
|
+
...entry.updateFrom === void 0 ? {} : { updateFrom: entry.updateFrom },
|
|
47426
47448
|
...entry.download === void 0 ? {} : { download: entry.download }
|
|
47427
47449
|
});
|
|
47428
47450
|
},
|
|
47429
|
-
children: adding === entry.source ? "Adding…" : "Add to my app"
|
|
47451
|
+
children: adding === entry.source ? entry.updateFrom === void 0 ? "Adding…" : "Updating…" : entry.updateFrom === void 0 ? "Add to my app" : `Update to v${entry.version}`
|
|
47430
47452
|
})
|
|
47431
47453
|
]
|
|
47432
47454
|
}),
|
|
@@ -47616,6 +47638,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47616
47638
|
const [details, setDetails] = (0, react.useState)(false);
|
|
47617
47639
|
const [copied, setCopied] = (0, react.useState)(void 0);
|
|
47618
47640
|
const [owner, setOwner] = (0, react.useState)("");
|
|
47641
|
+
const [askedNpm, setAskedNpm] = (0, react.useState)(false);
|
|
47619
47642
|
(0, react.useEffect)(() => {
|
|
47620
47643
|
let live = true;
|
|
47621
47644
|
readGithub().then((answer) => {
|
|
@@ -47654,6 +47677,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47654
47677
|
const ask = async (target) => {
|
|
47655
47678
|
if (share === void 0) return;
|
|
47656
47679
|
setDetails(false);
|
|
47680
|
+
setAskedNpm(target === "npm");
|
|
47657
47681
|
setState({
|
|
47658
47682
|
step: "working",
|
|
47659
47683
|
what: "Checking…"
|
|
@@ -47679,7 +47703,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47679
47703
|
const address = colleagueAddress(shared);
|
|
47680
47704
|
setState({
|
|
47681
47705
|
step: "done",
|
|
47682
|
-
text: plan.registry === true ? `Done. ${plugin.name} is shared. The registry lists new plugins within about an hour, then anyone can find it there.` : plan.visibility === "public" ? `Done. ${plugin.name} is shared with everyone.` : `Done. ${plugin.name} is shared with your team.`,
|
|
47706
|
+
text: plan.npm !== void 0 ? `Done. ${plugin.name} is published to npm as ${plan.npm.package}. Others take it with: npm run acryl -- plugin pull npm:${plan.npm.package}@${shared.version}` : plan.registry === true ? `Done. ${plugin.name} is shared. The registry lists new plugins within about an hour, then anyone can find it there.` : plan.visibility === "public" ? `Done. ${plugin.name} is shared with everyone.` : `Done. ${plugin.name} is shared with your team.`,
|
|
47683
47707
|
...address === void 0 ? {} : { address }
|
|
47684
47708
|
});
|
|
47685
47709
|
} catch (cause) {
|
|
@@ -47710,6 +47734,13 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47710
47734
|
target: "public",
|
|
47711
47735
|
disabled: share === void 0 || blocked
|
|
47712
47736
|
},
|
|
47737
|
+
{
|
|
47738
|
+
title: "npm",
|
|
47739
|
+
say: "Publish it as an npm package under the account above (blank: your npm login), sent with your own npm login (npm login in a terminal). Public.",
|
|
47740
|
+
button: "Publish to npm",
|
|
47741
|
+
target: "npm",
|
|
47742
|
+
disabled: share === void 0
|
|
47743
|
+
},
|
|
47713
47744
|
{
|
|
47714
47745
|
title: "Public registry",
|
|
47715
47746
|
say: "List it for everyone to search and add with one click. Public.",
|
|
@@ -47789,7 +47820,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47789
47820
|
},
|
|
47790
47821
|
children: choice.button
|
|
47791
47822
|
})] }, choice.title)) })] }),
|
|
47792
|
-
state.step === "confirm" || state.step === "working" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubNote, {
|
|
47823
|
+
state.step === "confirm" || state.step === "working" || state.step === "failed" && askedNpm ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubNote, {
|
|
47793
47824
|
github,
|
|
47794
47825
|
copy,
|
|
47795
47826
|
connect: connectGithub,
|
|
@@ -48250,7 +48281,9 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
48250
48281
|
title: "GitHub says this repository no longer exists; Share publishes it again",
|
|
48251
48282
|
children: [plugin.shared.url.replace(/^https:\/\//u, ""), " is gone"]
|
|
48252
48283
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
48253
|
-
"Shared on
|
|
48284
|
+
"Shared on ",
|
|
48285
|
+
sharedOn(plugin.shared),
|
|
48286
|
+
":",
|
|
48254
48287
|
" ",
|
|
48255
48288
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
48256
48289
|
className: "acrylBlendsShared",
|