@acryldev/blends-frame 0.2.10 → 0.2.11
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 +33 -8
- 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 +83 -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 +1 -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
|
}),
|
|
@@ -17610,16 +17618,22 @@ window.__ModuleLoader__.load({
|
|
|
17610
17618
|
*/
|
|
17611
17619
|
function shareQuestion(plan) {
|
|
17612
17620
|
const name = plan.repo;
|
|
17621
|
+
if (plan.npm !== void 0) {
|
|
17622
|
+
const sent = plan.released === void 0 ? "" : ` This sends version ${plan.version}, because ${plan.released} was already published.`;
|
|
17623
|
+
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}`;
|
|
17624
|
+
}
|
|
17613
17625
|
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
17626
|
const next = plan.released === void 0 ? "" : ` This sends version ${plan.version}, because ${plan.released} was already shared.`;
|
|
17615
17627
|
return `${who} It is kept on your GitHub account, ${plan.owner}.${next}`;
|
|
17616
17628
|
}
|
|
17617
17629
|
/** The words on the one big button that confirms a share. */
|
|
17618
17630
|
function shareButton(plan) {
|
|
17631
|
+
if (plan.npm !== void 0) return "Publish to npm";
|
|
17619
17632
|
return plan.registry === true ? "List in the registry" : plan.visibility === "public" ? "Share with everyone" : "Share with my team";
|
|
17620
17633
|
}
|
|
17621
17634
|
/** 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
17635
|
function shareSentence(plan) {
|
|
17636
|
+
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
17637
|
const where = `${plan.owner}/${plan.repo}`;
|
|
17624
17638
|
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
17639
|
}
|
|
@@ -17627,7 +17641,7 @@ window.__ModuleLoader__.load({
|
|
|
17627
17641
|
function shareDetails(plan) {
|
|
17628
17642
|
return [
|
|
17629
17643
|
shareSentence(plan),
|
|
17630
|
-
`Repository: ${plan.owner}/${plan.repo} on GitHub (${plan.createsRepository ? "a new one" : "it exists"}), ${plan.visibility}
|
|
17644
|
+
...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
17645
|
...plan.license === void 0 ? [] : [`License: ${plan.license}`],
|
|
17632
17646
|
...plan.registry === true ? ["Topic: cordis-plugin, which cordisplugins.github.io lists within about an hour"] : [],
|
|
17633
17647
|
...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 +17748,9 @@ window.__ModuleLoader__.load({
|
|
|
17734
17748
|
...target === void 0 ? { name } : target === "registry" ? {
|
|
17735
17749
|
name,
|
|
17736
17750
|
registry: true
|
|
17751
|
+
} : target === "npm" ? {
|
|
17752
|
+
name,
|
|
17753
|
+
npm: true
|
|
17737
17754
|
} : {
|
|
17738
17755
|
name,
|
|
17739
17756
|
visibility: target
|
|
@@ -47362,7 +47379,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47362
47379
|
className: "acrylBlendsShareAsk",
|
|
47363
47380
|
role: "alertdialog",
|
|
47364
47381
|
"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", {
|
|
47382
|
+
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
47383
|
className: "acrylBlendsShareRow",
|
|
47367
47384
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
47368
47385
|
type: "button",
|
|
@@ -47378,7 +47395,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47378
47395
|
onClick: () => {
|
|
47379
47396
|
add(item.source);
|
|
47380
47397
|
},
|
|
47381
|
-
children: "Add to my app"
|
|
47398
|
+
children: item.updateFrom === void 0 ? "Add to my app" : "Update"
|
|
47382
47399
|
})]
|
|
47383
47400
|
})]
|
|
47384
47401
|
});
|
|
@@ -47408,7 +47425,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47408
47425
|
title: "Made for another kind of app; it may not run in this one",
|
|
47409
47426
|
children: "other apps"
|
|
47410
47427
|
}),
|
|
47411
|
-
entry.installed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
47428
|
+
entry.installed && entry.updateFrom === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
47412
47429
|
className: "acrylBlendsRegAdded",
|
|
47413
47430
|
role: "status",
|
|
47414
47431
|
children: "Added"
|
|
@@ -47423,10 +47440,11 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47423
47440
|
name: entry.name,
|
|
47424
47441
|
owner: entry.owner,
|
|
47425
47442
|
origin: entry.origin,
|
|
47443
|
+
...entry.updateFrom === void 0 ? {} : { updateFrom: entry.updateFrom },
|
|
47426
47444
|
...entry.download === void 0 ? {} : { download: entry.download }
|
|
47427
47445
|
});
|
|
47428
47446
|
},
|
|
47429
|
-
children: adding === entry.source ? "Adding…" : "Add to my app"
|
|
47447
|
+
children: adding === entry.source ? entry.updateFrom === void 0 ? "Adding…" : "Updating…" : entry.updateFrom === void 0 ? "Add to my app" : `Update to v${entry.version}`
|
|
47430
47448
|
})
|
|
47431
47449
|
]
|
|
47432
47450
|
}),
|
|
@@ -47679,7 +47697,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47679
47697
|
const address = colleagueAddress(shared);
|
|
47680
47698
|
setState({
|
|
47681
47699
|
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.`,
|
|
47700
|
+
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
47701
|
...address === void 0 ? {} : { address }
|
|
47684
47702
|
});
|
|
47685
47703
|
} catch (cause) {
|
|
@@ -47710,6 +47728,13 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47710
47728
|
target: "public",
|
|
47711
47729
|
disabled: share === void 0 || blocked
|
|
47712
47730
|
},
|
|
47731
|
+
{
|
|
47732
|
+
title: "npm",
|
|
47733
|
+
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.",
|
|
47734
|
+
button: "Publish to npm",
|
|
47735
|
+
target: "npm",
|
|
47736
|
+
disabled: share === void 0
|
|
47737
|
+
},
|
|
47713
47738
|
{
|
|
47714
47739
|
title: "Public registry",
|
|
47715
47740
|
say: "List it for everyone to search and add with one click. Public.",
|