@acryldev/blends-frame 0.2.6 → 0.2.8
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/app-plugins.d.ts +3 -3
- package/lib/client.js +39 -18
- package/lib/client.js.map +1 -1
- package/lib/contract.d.ts +10 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +46 -15
- package/lib/index.js.map +1 -1
- package/lib/types/client/plugins-navigator.d.ts +5 -4
- package/lib/types/contract.d.ts +10 -0
- package/package.json +3 -3
package/lib/app-plugins.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `extensions` row finds it). `blend.yaml` is edited by lines, so its comments and layout stay as the person wrote them. The running app takes a
|
|
5
5
|
* switch when its Loader row (`app-plugins`) loads again, which the client asks for.
|
|
6
6
|
*/
|
|
7
|
-
import { type PublishGitPort, type RepositoryHostPort } from '@acryldev/plugin-hub-core';
|
|
7
|
+
import { type Placement, type PublishGitPort, type RepositoryHostPort } from '@acryldev/plugin-hub-core';
|
|
8
8
|
import { type AppPluginView, type FramePluginState, type FramePluginView, type SavedPluginResult, type SavedPluginView, type ShareVisibility, type SharedPluginView, type SharePlan } from './contract.ts';
|
|
9
9
|
/** One row of `blend.yaml`'s `spec.rows`: where its block starts and ends (line indexes, end exclusive). */
|
|
10
10
|
export interface BlendRow {
|
|
@@ -81,7 +81,7 @@ export declare function frameRowState(row: FrameRow): FramePluginState;
|
|
|
81
81
|
export declare function readFramePlugins(root: string, rows: readonly FrameRow[]): Promise<FramePluginView[]>;
|
|
82
82
|
/** The package.json a local plugin is shared with: the fields the builder's package_plugin writes (plugins/builder/index.ts), plus the Loader
|
|
83
83
|
* patch the plugin-hub's share requires so the package can also be installed as a row. */
|
|
84
|
-
export declare function pluginPackageManifest(name: string, description: string, version?: string, license?: string): Record<string, unknown>;
|
|
84
|
+
export declare function pluginPackageManifest(name: string, description: string, version?: string, license?: string, placement?: Placement): Record<string, unknown>;
|
|
85
85
|
/**
|
|
86
86
|
* The shares this app completed, from its own home (`shared-plugins.json`). The record is written only after the hub's whole share succeeded: a
|
|
87
87
|
* package.json can name a repository before the release exists, because the hub prepares it before its guards, and a refused share must not look
|
|
@@ -93,7 +93,7 @@ export declare function recordShare(file: string, name: string, shared: SharedPl
|
|
|
93
93
|
/** Where the frame packages the plugins it shares: under the app's home, never in the app's folder, so a share leaves no file to save. */
|
|
94
94
|
export declare const pluginPackagesOf: (home: string) => string;
|
|
95
95
|
/** Copy one local plugin into its package folder under `packages`, the way the builder's package_plugin does; answers the folder. */
|
|
96
|
-
export declare function packageAppPlugin(root: string, name: string, packages: string, license?: string): Promise<string>;
|
|
96
|
+
export declare function packageAppPlugin(root: string, name: string, packages: string, license?: string, placement?: Placement): Promise<string>;
|
|
97
97
|
/** Bump one package folder's patch version (what the hub asks for after a release), and answer the new version. */
|
|
98
98
|
export declare function bumpPackageVersion(dir: string): Promise<string>;
|
|
99
99
|
/**
|
package/lib/client.js
CHANGED
|
@@ -237,13 +237,18 @@ 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 } = value;
|
|
240
|
+
const { owner, repo, version, visibility, createsRepository, released, license, registry, placement } = 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 place = placement === void 0 ? void 0 : isRecord$5(placement) && typeof placement.category === "string" && (placement.subcategory === void 0 || typeof placement.subcategory === "string") ? {
|
|
248
|
+
category: placement.category,
|
|
249
|
+
...typeof placement.subcategory === "string" ? { subcategory: placement.subcategory } : {}
|
|
250
|
+
} : null;
|
|
251
|
+
if (place === null) throw new Error("share plan: placement");
|
|
247
252
|
return {
|
|
248
253
|
owner,
|
|
249
254
|
repo,
|
|
@@ -252,7 +257,8 @@ window.__ModuleLoader__.load({
|
|
|
252
257
|
createsRepository,
|
|
253
258
|
...released === void 0 ? {} : { released },
|
|
254
259
|
...license === void 0 ? {} : { license },
|
|
255
|
-
...registry === true ? { registry } : {}
|
|
260
|
+
...registry === true ? { registry } : {},
|
|
261
|
+
...place === void 0 ? {} : { placement: place }
|
|
256
262
|
};
|
|
257
263
|
}
|
|
258
264
|
/** @throws when the value is not what a save answers. */
|
|
@@ -17621,7 +17627,8 @@ window.__ModuleLoader__.load({
|
|
|
17621
17627
|
shareSentence(plan),
|
|
17622
17628
|
`Repository: ${plan.owner}/${plan.repo} on GitHub (${plan.createsRepository ? "a new one" : "it exists"}), ${plan.visibility}`,
|
|
17623
17629
|
...plan.license === void 0 ? [] : [`License: ${plan.license}`],
|
|
17624
|
-
...plan.registry === true ? ["Topic: cordis-plugin, which cordisplugins.github.io lists within about an hour"] : []
|
|
17630
|
+
...plan.registry === true ? ["Topic: cordis-plugin, which cordisplugins.github.io lists within about an hour"] : [],
|
|
17631
|
+
...plan.placement === void 0 ? [] : [`Category: ${plan.placement.category}${plan.placement.subcategory === void 0 ? "" : ` › ${plan.placement.subcategory}`}, where this app is in the Blends store`]
|
|
17625
17632
|
];
|
|
17626
17633
|
}
|
|
17627
17634
|
const DAY_MS = 864e5;
|
|
@@ -17713,7 +17720,7 @@ window.__ModuleLoader__.load({
|
|
|
17713
17720
|
});
|
|
17714
17721
|
if (!response.ok) return errorOf$1(response);
|
|
17715
17722
|
},
|
|
17716
|
-
async planShare(name, target) {
|
|
17723
|
+
async planShare(name, target, owner) {
|
|
17717
17724
|
const response = await fetcher(FRAME_PLUGINS_SHARE_PLAN_PATH, {
|
|
17718
17725
|
method: "POST",
|
|
17719
17726
|
credentials: "same-origin",
|
|
@@ -17721,12 +17728,15 @@ window.__ModuleLoader__.load({
|
|
|
17721
17728
|
"Content-Type": "application/json",
|
|
17722
17729
|
Accept: "application/json"
|
|
17723
17730
|
},
|
|
17724
|
-
body: JSON.stringify(
|
|
17725
|
-
name
|
|
17726
|
-
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17731
|
+
body: JSON.stringify({
|
|
17732
|
+
...target === void 0 ? { name } : target === "registry" ? {
|
|
17733
|
+
name,
|
|
17734
|
+
registry: true
|
|
17735
|
+
} : {
|
|
17736
|
+
name,
|
|
17737
|
+
visibility: target
|
|
17738
|
+
},
|
|
17739
|
+
...owner === void 0 ? {} : { owner }
|
|
17730
17740
|
})
|
|
17731
17741
|
});
|
|
17732
17742
|
if (!response.ok) return errorOf$1(response);
|
|
@@ -17745,7 +17755,7 @@ window.__ModuleLoader__.load({
|
|
|
17745
17755
|
if (!response.ok) return errorOf$1(response);
|
|
17746
17756
|
return parseSavedPlugin(await response.json());
|
|
17747
17757
|
},
|
|
17748
|
-
async share(name, confirmed) {
|
|
17758
|
+
async share(name, confirmed, owner) {
|
|
17749
17759
|
const response = await fetcher(FRAME_PLUGINS_SHARE_PATH, {
|
|
17750
17760
|
method: "POST",
|
|
17751
17761
|
credentials: "same-origin",
|
|
@@ -17755,7 +17765,8 @@ window.__ModuleLoader__.load({
|
|
|
17755
17765
|
},
|
|
17756
17766
|
body: JSON.stringify({
|
|
17757
17767
|
name,
|
|
17758
|
-
confirm: confirmed
|
|
17768
|
+
confirm: confirmed,
|
|
17769
|
+
...owner === void 0 ? {} : { owner }
|
|
17759
17770
|
})
|
|
17760
17771
|
});
|
|
17761
17772
|
if (!response.ok) return errorOf$1(response);
|
|
@@ -47602,6 +47613,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47602
47613
|
const [github, setGithub] = (0, react.useState)({ status: "checking" });
|
|
47603
47614
|
const [details, setDetails] = (0, react.useState)(false);
|
|
47604
47615
|
const [copied, setCopied] = (0, react.useState)(void 0);
|
|
47616
|
+
const [owner, setOwner] = (0, react.useState)("");
|
|
47605
47617
|
(0, react.useEffect)(() => {
|
|
47606
47618
|
let live = true;
|
|
47607
47619
|
readGithub().then((answer) => {
|
|
@@ -47617,6 +47629,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47617
47629
|
};
|
|
47618
47630
|
}, [readGithub]);
|
|
47619
47631
|
const share = plugin.share;
|
|
47632
|
+
const ownerAsked = owner.trim() === "" ? void 0 : owner.trim();
|
|
47620
47633
|
const blocked = github.status === "missing" || github.status === "signed-out";
|
|
47621
47634
|
const idle = state.step === "choose" || state.step === "failed" || state.step === "done";
|
|
47622
47635
|
const save = async () => {
|
|
@@ -47646,7 +47659,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47646
47659
|
try {
|
|
47647
47660
|
setState({
|
|
47648
47661
|
step: "confirm",
|
|
47649
|
-
plan: await share.plan(target)
|
|
47662
|
+
plan: await share.plan(target, ownerAsked)
|
|
47650
47663
|
});
|
|
47651
47664
|
} catch (cause) {
|
|
47652
47665
|
setState(failed(cause));
|
|
@@ -47659,7 +47672,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47659
47672
|
what: "Sharing…"
|
|
47660
47673
|
});
|
|
47661
47674
|
try {
|
|
47662
|
-
const shared = await share.publish(plan);
|
|
47675
|
+
const shared = await share.publish(plan, ownerAsked);
|
|
47663
47676
|
onShared(shared);
|
|
47664
47677
|
const address = colleagueAddress(shared);
|
|
47665
47678
|
setState({
|
|
@@ -47758,14 +47771,22 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
47758
47771
|
children: shareDetails(state.plan).map((line) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: line }, line))
|
|
47759
47772
|
})
|
|
47760
47773
|
]
|
|
47761
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.
|
|
47774
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [share !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
47775
|
+
className: "acrylBlendsSearch",
|
|
47776
|
+
"aria-label": "GitHub account or organization",
|
|
47777
|
+
placeholder: "GitHub account or organization (blank: yours)",
|
|
47778
|
+
value: owner,
|
|
47779
|
+
onChange: (event) => {
|
|
47780
|
+
setOwner(event.target.value);
|
|
47781
|
+
}
|
|
47782
|
+
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", { children: choices.map((choice) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: choice.title }), choice.say] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
47762
47783
|
type: "button",
|
|
47763
47784
|
disabled: choice.disabled || !idle,
|
|
47764
47785
|
onClick: () => {
|
|
47765
47786
|
choice.target === void 0 ? save() : ask(choice.target);
|
|
47766
47787
|
},
|
|
47767
47788
|
children: choice.button
|
|
47768
|
-
})] }, choice.title)) }),
|
|
47789
|
+
})] }, choice.title)) })] }),
|
|
47769
47790
|
state.step === "confirm" || state.step === "working" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubNote, {
|
|
47770
47791
|
github,
|
|
47771
47792
|
copy,
|
|
@@ -50748,8 +50769,8 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
|
|
|
50748
50769
|
await appPlugins.switch(plugin.kind, plugin.name, on);
|
|
50749
50770
|
canvas.reload();
|
|
50750
50771
|
}, plugin.kind === "made" ? {
|
|
50751
|
-
plan: (target) => appPlugins.planShare(plugin.name, target),
|
|
50752
|
-
publish: (confirmed) => appPlugins.share(plugin.name, confirmed)
|
|
50772
|
+
plan: (target, owner) => appPlugins.planShare(plugin.name, target, owner),
|
|
50773
|
+
publish: (confirmed, owner) => appPlugins.share(plugin.name, confirmed, owner)
|
|
50753
50774
|
} : void 0, void 0, {
|
|
50754
50775
|
...plugin.kind === "made" ? { save: () => appPlugins.save(plugin.name) } : {},
|
|
50755
50776
|
...viewSource === void 0 ? {} : { viewSource }
|