fluxplugin 1.0.2 → 1.0.4

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.
Files changed (50) hide show
  1. package/README.md +15 -12
  2. package/dist/browser/chunks/chunk-AV4KI7LI.js +1792 -0
  3. package/dist/browser/chunks/{chunk-TL63576R.js → chunk-OAYWYU5O.js} +48 -11
  4. package/dist/browser/index.js +3 -1
  5. package/dist/browser/manager-ui.js +386 -185
  6. package/dist/browser/react.js +46 -2
  7. package/dist/cli.js +3622 -257
  8. package/dist/node/chunks/{chunk-EVX2O65A.js → chunk-SDCGUBEW.js} +49 -11
  9. package/dist/node/chunks/{chunk-C7VWZZOX.js → chunk-ZLA5XUXN.js} +175 -51
  10. package/dist/node/cli-api.js +742 -76
  11. package/dist/node/index.js +3 -1
  12. package/dist/node/main.js +8 -2
  13. package/dist/node/preload.js +1 -1
  14. package/dist/types/cli/build.d.ts +5 -0
  15. package/dist/types/cli/cli.d.ts +2 -0
  16. package/dist/types/cli/dist.d.ts +18 -0
  17. package/dist/types/cli/host-templates.d.ts +2 -0
  18. package/dist/types/cli/store.d.ts +13 -0
  19. package/dist/types/cli/templates.d.ts +2 -0
  20. package/dist/types/core/manifest.d.ts +15 -1
  21. package/dist/types/core/protocol.d.ts +18 -5
  22. package/dist/types/core/registry.d.ts +11 -0
  23. package/dist/types/core/routes.d.ts +3 -1
  24. package/dist/types/main/adapters.d.ts +3 -0
  25. package/dist/types/main/assets.d.ts +8 -0
  26. package/dist/types/main/github-registry.d.ts +2 -1
  27. package/dist/types/main/index.d.ts +1 -0
  28. package/dist/types/main/registry.d.ts +55 -18
  29. package/dist/types/main/stores.d.ts +7 -1
  30. package/dist/types/manager-ui/index.d.ts +35 -3
  31. package/dist/types/react/base-css.d.ts +6 -2
  32. package/dist/types/react/http-bridge.d.ts +5 -0
  33. package/dist/types/react/i18n.d.ts +33 -0
  34. package/dist/types/react/index.d.ts +5 -0
  35. package/dist/types/react/markdown.d.ts +2 -1
  36. package/dist/types/react/media.d.ts +33 -0
  37. package/dist/types/react/settings.d.ts +6 -0
  38. package/dist/types/react/sidebar.d.ts +42 -0
  39. package/dist/types/react/theme.d.ts +42 -4
  40. package/dist/types/react/ui.d.ts +42 -0
  41. package/docs/CUSTOMIZING.md +56 -0
  42. package/docs/STORE.md +19 -0
  43. package/docs/screenshots/plugin-page.png +0 -0
  44. package/docs/screenshots/settings-appearance.png +0 -0
  45. package/docs/screenshots/site-guide-dark.png +0 -0
  46. package/docs/screenshots/site-home.png +0 -0
  47. package/docs/screenshots/site-mobile.png +0 -0
  48. package/docs/screenshots/site-search.png +0 -0
  49. package/package.json +1 -1
  50. package/dist/browser/chunks/chunk-VXQJIDXW.js +0 -1232
@@ -1,26 +1,162 @@
1
1
  import {
2
+ Button,
3
+ Group,
2
4
  Icon,
5
+ Img,
3
6
  Markdown,
4
7
  PluginSlot,
8
+ Row,
9
+ Segmented,
10
+ Switch,
11
+ VideoPlayer,
12
+ navigate,
13
+ useParams,
14
+ usePlugin,
5
15
  usePluginFramework,
6
- usePlugins
7
- } from "./chunks/chunk-VXQJIDXW.js";
8
- import "./chunks/chunk-TL63576R.js";
16
+ usePlugins,
17
+ useT
18
+ } from "./chunks/chunk-AV4KI7LI.js";
19
+ import {
20
+ parseVideo
21
+ } from "./chunks/chunk-OAYWYU5O.js";
9
22
 
10
23
  // src/manager-ui/index.tsx
11
- import { useCallback, useEffect, useState } from "react";
24
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
12
25
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
- var css = `.fluxm{font:14px system-ui;color:var(--flux-fg,#0f172a)}.fluxm h2{margin:0 0 12px}.fluxm-tabs{display:flex;gap:6px;margin-bottom:12px}
14
- .fluxm button{cursor:pointer;border:1px solid var(--flux-border,#e2e8f0);background:var(--flux-surface,#f8fafc);color:inherit;border-radius:8px;padding:5px 10px}
15
- .fluxm button.on{background:var(--flux-accent,#4f46e5);color:#fff;border-color:transparent}.fluxm button.danger{color:#dc2626}
16
- .fluxm-row{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid var(--flux-border,#e2e8f0);border-radius:10px;margin-bottom:8px}
17
- .fluxm-grow{flex:1;min-width:0}.fluxm-muted{color:var(--flux-muted,#64748b);font-size:12px}
18
- .fluxm-badge{font-size:11px;padding:1px 8px;border-radius:99px;background:#e2e8f0;color:#334155}.fluxm-ready{background:#dcfce7;color:#166534}.fluxm-error{background:#fee2e2;color:#991b1b}.fluxm-disabled{background:#f1f5f9;color:#64748b}
19
- .fluxm-panel{border:1px solid var(--flux-border,#e2e8f0);border-radius:12px;padding:14px;margin-top:12px}.fluxm pre{max-height:180px;overflow:auto;font-size:11px;background:var(--flux-surface,#f8fafc);padding:8px;border-radius:8px}
20
- .fluxm label{display:flex;gap:8px;align-items:center;margin:6px 0}.fluxm input[type=text],.fluxm input[type=number]{padding:4px 8px;border:1px solid var(--flux-border,#e2e8f0);border-radius:6px}`;
21
- var badge = (p) => /* @__PURE__ */ jsx("span", { className: `fluxm-badge fluxm-${p.state === "ready" ? "ready" : p.state === "error" ? "error" : p.state === "disabled" ? "disabled" : ""}`, children: p.state });
26
+ var RISKY = /* @__PURE__ */ new Set(["network", "filesystem.read", "filesystem.write", "shell", "database", "clipboard", "window"]);
27
+ var PERMISSIONS = {
28
+ ipc: ["Talk to the app's background process", "Call and answer background tasks."],
29
+ services: ["Share and use services", "Offer features to other plugins and use theirs."],
30
+ events: ["Send and receive events", "React to what happens in the app."],
31
+ hooks: ["Change how the app behaves", "Intercept, validate or modify operations."],
32
+ commands: ["Add commands", "Appear in the command palette and menus, with shortcuts."],
33
+ routes: ["Add pages", "Create its own screens in the app."],
34
+ menus: ["Add menu entries", "Appear in the menu bar and sidebar."],
35
+ ui: ["Add interface elements", "Place widgets and buttons in the app."],
36
+ styles: ["Style the interface", "Add its own look."],
37
+ storage: ["Save its own data", "Keep settings and data on this device."],
38
+ notifications: ["Show notifications", "Alert you inside the app."],
39
+ network: ["Use the network", "Connect to the internet."],
40
+ "filesystem.read": ["Read files", "Open files on your computer."],
41
+ "filesystem.write": ["Write files", "Create or change files on your computer."],
42
+ database: ["Use the database", "Read and write the app's data."],
43
+ window: ["Control windows", "Open, move or resize windows."],
44
+ clipboard: ["Use the clipboard", "Copy and paste for you."],
45
+ shell: ["Run system commands", "Launch programs on your computer."]
46
+ };
47
+ var permInfo = (p) => PERMISSIONS[p] ?? (p.startsWith("x.") ? [`Custom access: ${p.slice(2)}`, "A capability defined by this app."] : [p, ""]);
48
+ var fromDetails = (d, info, assetBase) => ({
49
+ id: d.id,
50
+ name: d.name,
51
+ version: d.version,
52
+ description: d.description,
53
+ author: d.author,
54
+ license: d.license,
55
+ iconUrl: d.iconUrl,
56
+ bannerUrl: d.bannerUrl,
57
+ screenshots: d.screenshotUrls,
58
+ video: d.video,
59
+ categories: d.categories,
60
+ keywords: d.keywords,
61
+ links: d.links,
62
+ readme: d.readme,
63
+ permissions: info.permissions.declared,
64
+ dependencies: info.dependencies,
65
+ assetBase,
66
+ homepage: d.homepage
67
+ });
68
+ var fromEntry = (e) => ({
69
+ id: e.id,
70
+ name: e.name,
71
+ version: e.version,
72
+ description: e.description,
73
+ author: e.author,
74
+ license: e.license,
75
+ iconUrl: e.iconUrl,
76
+ bannerUrl: e.bannerUrl,
77
+ screenshots: e.screenshots ?? [],
78
+ video: parseVideo(e.video) ?? void 0,
79
+ categories: e.categories ?? [],
80
+ keywords: e.keywords ?? [],
81
+ links: e.links ?? {},
82
+ readme: e.readme,
83
+ permissions: e.permissions,
84
+ dependencies: {},
85
+ assetBase: e.location,
86
+ homepage: e.homepage
87
+ });
88
+ var storeCache = [];
89
+ var stateLabel = (p) => p.state === "ready" ? ["Active", "ok"] : p.state === "error" ? ["Error", "err"] : p.state === "disabled" ? ["Disabled", ""] : [p.state, ""];
90
+ function Icon56({ url, base, large }) {
91
+ return /* @__PURE__ */ jsx(Img, { className: "flux-pm-icon" + (large ? " lg" : ""), src: url, base, alt: "", fallback: /* @__PURE__ */ jsx("span", { className: "flux-pm-icon" + (large ? " lg" : ""), style: { background: "var(--flux-accent)", color: "#fff", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx(Icon, { name: "plug", size: large ? 44 : 24 }) }) });
92
+ }
93
+ function useDetails(id) {
94
+ const { client } = usePluginFramework();
95
+ const [d, setD] = useState();
96
+ const info = usePlugin(id);
97
+ useEffect(() => {
98
+ let live = true;
99
+ setD(void 0);
100
+ client.details(id).then((x) => live && setD(x)).catch(() => void 0);
101
+ return () => {
102
+ live = false;
103
+ };
104
+ }, [client, id, info?.version]);
105
+ return { d, info };
106
+ }
107
+ function Facts({ v, extra }) {
108
+ const items = [["Category", v.categories[0] ?? "Plugin"], ["Version", v.version], ["License", v.license ?? "\u2014"], ["Developer", v.author ?? "\u2014"], ["Access", `${v.permissions.length}`], ...extra ?? []];
109
+ return /* @__PURE__ */ jsx("div", { className: "flux-pm-facts", children: items.map(([k, val]) => /* @__PURE__ */ jsxs("div", { className: "flux-pm-fact", children: [
110
+ /* @__PURE__ */ jsx("small", { children: k }),
111
+ /* @__PURE__ */ jsx("b", { children: val })
112
+ ] }, k)) });
113
+ }
114
+ function Gallery({ v }) {
115
+ const [zoom, setZoom] = useState();
116
+ if (!v.screenshots.length) return null;
117
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
118
+ /* @__PURE__ */ jsx("h3", { className: "sec", children: "Preview" }),
119
+ /* @__PURE__ */ jsx("div", { className: "flux-pm-shots", "data-testid": "plugin-shots", children: v.screenshots.map((u) => /* @__PURE__ */ jsx(Img, { src: u, base: v.assetBase, alt: "screenshot", onClick: () => setZoom(u) }, u)) }),
120
+ zoom && /* @__PURE__ */ jsx("div", { className: "flux-zoom", onClick: () => setZoom(void 0), children: /* @__PURE__ */ jsx(Img, { src: zoom, base: v.assetBase, alt: "" }) })
121
+ ] });
122
+ }
123
+ function Body({ v, permissionsSlot }) {
124
+ const t = useT();
125
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
126
+ v.bannerUrl && /* @__PURE__ */ jsx(Img, { className: "flux-pm-banner", src: v.bannerUrl, base: v.assetBase, alt: "" }),
127
+ /* @__PURE__ */ jsx(Gallery, { v }),
128
+ v.video && /* @__PURE__ */ jsxs(Fragment, { children: [
129
+ /* @__PURE__ */ jsx("h3", { className: "sec", children: t("plugins.video", "Video") }),
130
+ /* @__PURE__ */ jsx(VideoPlayer, { video: v.video, poster: void 0, title: `${v.name} video` })
131
+ ] }),
132
+ v.readme && /* @__PURE__ */ jsxs(Fragment, { children: [
133
+ /* @__PURE__ */ jsx("h3", { className: "sec", children: t("plugins.about", "About") }),
134
+ /* @__PURE__ */ jsx("div", { "data-testid": "plugin-readme", children: /* @__PURE__ */ jsx(Markdown, { source: v.readme, baseUrl: v.assetBase }) })
135
+ ] }),
136
+ /* @__PURE__ */ jsx("h3", { className: "sec", children: t("plugins.permissions", "Permissions") }),
137
+ /* @__PURE__ */ jsxs(Group, { footer: t("plugins.permissionsFooter", "Plugins only get what they declare. Risky access is highlighted."), children: [
138
+ v.permissions.length === 0 && /* @__PURE__ */ jsx(Row, { title: t("plugins.noPermissions", "No special access") }),
139
+ v.permissions.map((p) => {
140
+ const [title, desc] = permInfo(p);
141
+ return /* @__PURE__ */ jsx(Row, { icon: RISKY.has(p) ? "shield" : "check", iconColor: RISKY.has(p) ? "var(--flux-warn)" : "var(--flux-ok)", title: t(`perm.${p}`, title), subtitle: desc, right: permissionsSlot?.(p) ?? (RISKY.has(p) ? /* @__PURE__ */ jsx("span", { className: "flux-pill warn", children: t("plugins.sensitive", "Sensitive") }) : void 0) }, p);
142
+ })
143
+ ] }),
144
+ /* @__PURE__ */ jsx("h3", { className: "sec", children: t("plugins.information", "Information") }),
145
+ /* @__PURE__ */ jsxs(Group, { children: [
146
+ /* @__PURE__ */ jsx(Row, { title: t("plugins.developer", "Developer"), right: v.author ?? "\u2014" }),
147
+ /* @__PURE__ */ jsx(Row, { title: t("plugins.version", "Version"), right: v.version }),
148
+ /* @__PURE__ */ jsx(Row, { title: t("plugins.license", "License"), right: v.license ?? "\u2014" }),
149
+ /* @__PURE__ */ jsx(Row, { title: "ID", right: /* @__PURE__ */ jsx("code", { children: v.id }) }),
150
+ Object.keys(v.dependencies).length > 0 && /* @__PURE__ */ jsx(Row, { title: t("plugins.dependencies", "Requires"), right: Object.entries(v.dependencies).map(([k, r]) => `${k} ${r}`).join(", ") }),
151
+ v.keywords.length > 0 && /* @__PURE__ */ jsx(Row, { title: t("plugins.keywords", "Keywords"), right: v.keywords.join(", ") }),
152
+ Object.entries(v.links).map(([k, u]) => /* @__PURE__ */ jsx(Row, { icon: "external", iconColor: "var(--flux-muted)", title: k[0].toUpperCase() + k.slice(1), right: /* @__PURE__ */ jsx("a", { href: u, target: "_blank", rel: "noopener noreferrer", children: new URL(u).hostname }) }, k)),
153
+ v.homepage && /* @__PURE__ */ jsx(Row, { icon: "external", iconColor: "var(--flux-muted)", title: "Source", right: /* @__PURE__ */ jsx("a", { href: v.homepage, target: "_blank", rel: "noopener noreferrer", children: new URL(v.homepage).hostname }) })
154
+ ] })
155
+ ] });
156
+ }
22
157
  function ConfigForm({ id }) {
23
158
  const { client } = usePluginFramework();
159
+ const t = useT();
24
160
  const [schema, setSchema] = useState(null);
25
161
  const [values, setValues] = useState({});
26
162
  const [msg, setMsg] = useState("");
@@ -29,212 +165,277 @@ function ConfigForm({ id }) {
29
165
  client.configGet(id).then(setValues).catch(() => void 0);
30
166
  }, [client, id]);
31
167
  if (!schema?.properties) return null;
32
- const save = (patch) => client.configSet(id, patch).then((v) => (setValues(v), setMsg("Saved"))).catch((e) => setMsg(String(e.message)));
33
- return /* @__PURE__ */ jsxs("div", { className: "fluxm-panel", children: [
34
- /* @__PURE__ */ jsx("strong", { children: "Settings" }),
35
- Object.entries(schema.properties).map(([k, d]) => /* @__PURE__ */ jsxs("label", { children: [
36
- /* @__PURE__ */ jsx("span", { style: { minWidth: 120 }, children: d.title ?? k }),
37
- d.type === "boolean" ? /* @__PURE__ */ jsx("input", { type: "checkbox", checked: !!values[k], onChange: (e) => save({ [k]: e.target.checked }) }) : d.type === "enum" ? /* @__PURE__ */ jsx("select", { value: values[k] ?? "", onChange: (e) => save({ [k]: e.target.value }), children: d.enum?.map((o) => /* @__PURE__ */ jsx("option", { children: String(o) }, String(o))) }) : /* @__PURE__ */ jsx("input", { type: d.type === "number" ? "number" : "text", value: values[k] ?? "", onChange: (e) => setValues({ ...values, [k]: d.type === "number" ? Number(e.target.value) : e.target.value }), onBlur: () => save({ [k]: values[k] }) })
38
- ] }, k)),
39
- /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: msg }),
40
- /* @__PURE__ */ jsx("button", { onClick: () => client.configReset(id).then(setValues), children: "Reset to defaults" })
168
+ const save = (patch) => client.configSet(id, patch).then((v) => (setValues(v), setMsg(t("plugins.saved", "Saved")))).catch((e) => setMsg(e.message));
169
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
170
+ /* @__PURE__ */ jsx("h3", { className: "sec", children: t("plugins.settings", "Settings") }),
171
+ /* @__PURE__ */ jsxs(Group, { footer: msg || void 0, children: [
172
+ Object.entries(schema.properties).map(([k, d]) => /* @__PURE__ */ jsx(Row, { title: d.title ?? k, subtitle: d.description, right: d.type === "boolean" ? /* @__PURE__ */ jsx(Switch, { checked: !!values[k], onChange: (v) => void save({ [k]: v }), label: d.title ?? k }) : d.type === "enum" ? /* @__PURE__ */ jsx("select", { className: "flux-select", value: values[k] ?? "", onChange: (e) => void save({ [k]: e.target.value }), children: d.enum?.map((o) => /* @__PURE__ */ jsx("option", { children: String(o) }, String(o))) }) : /* @__PURE__ */ jsx("input", { className: "flux-input", style: { width: 160 }, type: d.type === "number" ? "number" : "text", value: values[k] ?? "", onChange: (e) => setValues({ ...values, [k]: d.type === "number" ? Number(e.target.value) : e.target.value }), onBlur: () => void save({ [k]: values[k] }) }) }, k)),
173
+ /* @__PURE__ */ jsx(Row, { title: t("plugins.reset", "Reset to defaults"), onClick: () => void client.configReset(id).then(setValues) })
174
+ ] })
41
175
  ] });
42
176
  }
43
- var css2 = `.fluxm-icon{width:40px;height:40px;border-radius:10px;object-fit:cover;background:var(--flux-border);display:inline-flex;align-items:center;justify-content:center;flex:none}
44
- .fluxm-banner{width:100%;max-height:180px;object-fit:cover;border-radius:10px;margin:8px 0}.fluxm-shots{display:flex;gap:8px;overflow:auto;padding:4px 0}.fluxm-shots img{height:110px;border-radius:8px;border:1px solid var(--flux-border);cursor:zoom-in}
45
- .fluxm-video{aspect-ratio:16/9;width:100%;max-width:560px;border:0;border-radius:10px;background:#000}.fluxm-chip{display:inline-block;font-size:11px;padding:1px 8px;border-radius:99px;background:var(--flux-surface);border:1px solid var(--flux-border);margin:0 4px 4px 0}
46
- .fluxm-zoom{position:fixed;inset:0;background:rgba(0,0,0,.8);display:flex;align-items:center;justify-content:center;z-index:9999;cursor:zoom-out}.fluxm-zoom img{max-width:92vw;max-height:90vh;border-radius:10px}
47
- .fluxm h3{margin:16px 0 6px;font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:var(--flux-muted)}`;
48
- function PluginIcon({ id, url }) {
49
- const [broken, setBroken] = useState(false);
50
- return url && !broken ? /* @__PURE__ */ jsx("img", { className: "fluxm-icon", src: url, alt: "", "data-testid": "icon-" + id, onError: () => setBroken(true) }) : /* @__PURE__ */ jsx("span", { className: "fluxm-icon", children: /* @__PURE__ */ jsx(Icon, { name: "plug", size: 20 }) });
51
- }
52
- function Details({ p, onClose }) {
177
+ function Logs({ id, state }) {
53
178
  const { client } = usePluginFramework();
179
+ const t = useT();
54
180
  const [logs, setLogs] = useState([]);
55
- const [d, setD] = useState();
56
- const [zoom, setZoom] = useState();
57
- useEffect(() => {
58
- client.logs(p.id).then(setLogs).catch(() => void 0);
59
- }, [client, p.id, p.state]);
60
181
  useEffect(() => {
61
- setD(void 0);
62
- client.details(p.id).then(setD).catch(() => void 0);
63
- }, [client, p.id, p.version]);
64
- return /* @__PURE__ */ jsxs("div", { className: "fluxm-panel", "data-testid": "plugin-details", children: [
65
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 12, alignItems: "center" }, children: [
66
- /* @__PURE__ */ jsx(PluginIcon, { id: p.id, url: d?.iconUrl }),
67
- /* @__PURE__ */ jsxs("div", { className: "fluxm-grow", children: [
68
- /* @__PURE__ */ jsx("strong", { children: p.name }),
69
- " ",
70
- /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
71
- p.id,
72
- "@",
73
- p.version
74
- ] }),
75
- /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: [d?.author, d?.license].filter(Boolean).join(" \xB7 ") })
76
- ] }),
77
- /* @__PURE__ */ jsx("button", { onClick: onClose, children: "Close" })
182
+ client.logs(id).then(setLogs).catch(() => void 0);
183
+ }, [client, id, state]);
184
+ return /* @__PURE__ */ jsxs("details", { style: { marginTop: 26 }, children: [
185
+ /* @__PURE__ */ jsxs("summary", { style: { cursor: "pointer", fontWeight: 600 }, children: [
186
+ t("plugins.logs", "Logs"),
187
+ " (",
188
+ logs.length,
189
+ ")"
78
190
  ] }),
79
- /* @__PURE__ */ jsxs("div", { children: [
80
- d?.categories.map((c) => /* @__PURE__ */ jsx("span", { className: "fluxm-chip", children: c }, c)),
81
- d?.keywords.map((c) => /* @__PURE__ */ jsxs("span", { className: "fluxm-chip", children: [
82
- "#",
83
- c
84
- ] }, c))
191
+ /* @__PURE__ */ jsx("pre", { className: "flux-pre", children: logs.map((l) => `${new Date(l.time).toLocaleTimeString()} ${l.level.toUpperCase()} ${l.message}`).join("\n") || t("plugins.noLogs", "No logs") })
192
+ ] });
193
+ }
194
+ var back = () => history.length > 1 ? history.back() : navigate("/plugins");
195
+ function PluginDetailsPage() {
196
+ const t = useT();
197
+ const { client } = usePluginFramework();
198
+ const { id = "" } = useParams();
199
+ const { d, info } = useDetails(id);
200
+ const [busy, setBusy] = useState("");
201
+ const run = async (label, fn, after) => {
202
+ setBusy(label);
203
+ try {
204
+ await fn();
205
+ after?.();
206
+ } catch (e) {
207
+ alert(e.message);
208
+ } finally {
209
+ setBusy("");
210
+ }
211
+ };
212
+ if (!info) return /* @__PURE__ */ jsxs("div", { className: "flux-pm", children: [
213
+ /* @__PURE__ */ jsxs("button", { className: "flux-pm-back", onClick: back, children: [
214
+ /* @__PURE__ */ jsx(Icon, { name: "back", size: 20 }),
215
+ t("plugins.back", "Plugins")
85
216
  ] }),
86
- d?.bannerUrl && /* @__PURE__ */ jsx("img", { className: "fluxm-banner", src: d.bannerUrl, alt: "" }),
87
- /* @__PURE__ */ jsx("p", { children: p.description }),
88
- p.error && /* @__PURE__ */ jsxs("p", { className: "fluxm-error fluxm-badge", children: [
89
- p.error.phase,
90
- ": ",
91
- p.error.message
217
+ /* @__PURE__ */ jsx("div", { className: "flux-empty", children: t("plugins.notFound", "This plugin is not installed.") })
218
+ ] });
219
+ const view = d ? fromDetails(d, info, d.assetBase) : void 0;
220
+ const [stateText, cls] = stateLabel(info);
221
+ return /* @__PURE__ */ jsxs("div", { className: "flux-pm", "data-testid": "plugin-details", children: [
222
+ /* @__PURE__ */ jsxs("button", { className: "flux-pm-back", onClick: back, "data-testid": "plugin-back", children: [
223
+ /* @__PURE__ */ jsx(Icon, { name: "back", size: 20 }),
224
+ t("plugins.back", "Plugins")
92
225
  ] }),
93
- d?.video && /* @__PURE__ */ jsxs(Fragment, { children: [
94
- /* @__PURE__ */ jsx("h3", { children: "Video" }),
95
- d.video.embedUrl ? /* @__PURE__ */ jsx("iframe", { className: "fluxm-video", "data-testid": "plugin-video", src: d.video.embedUrl, title: "Plugin video", allow: "encrypted-media; picture-in-picture; fullscreen", sandbox: "allow-scripts allow-same-origin allow-presentation", referrerPolicy: "strict-origin-when-cross-origin", allowFullScreen: true }) : /* @__PURE__ */ jsxs("a", { href: d.video.url, target: "_blank", rel: "noopener noreferrer", children: [
96
- /* @__PURE__ */ jsx(Icon, { name: "play" }),
97
- " Watch the video"
226
+ /* @__PURE__ */ jsxs("div", { className: "flux-pm-hero", children: [
227
+ /* @__PURE__ */ jsx(Icon56, { url: d?.iconUrl, large: true }),
228
+ /* @__PURE__ */ jsxs("div", { children: [
229
+ /* @__PURE__ */ jsx("h1", { children: info.name }),
230
+ /* @__PURE__ */ jsxs("div", { className: "by", children: [
231
+ info.author ?? info.id,
232
+ " \xB7 ",
233
+ /* @__PURE__ */ jsx("span", { className: "flux-pill " + cls, children: t(`state.${info.state}`, stateText) })
234
+ ] }),
235
+ /* @__PURE__ */ jsxs("div", { className: "flux-pm-actions", children: [
236
+ /* @__PURE__ */ jsx(Switch, { checked: info.enabled, label: t("plugins.enable", "Enable"), disabled: !!busy, onChange: (on) => void run(on ? "enabling" : "disabling", () => on ? client.enable(info.id) : client.disable(info.id)) }),
237
+ /* @__PURE__ */ jsx("span", { style: { color: "var(--flux-muted)" }, children: info.enabled ? t("plugins.enabled", "Enabled") : t("plugins.disabled", "Disabled") }),
238
+ /* @__PURE__ */ jsx(Button, { size: "sm", onClick: () => void run("reloading", () => client.reload(info.id)), children: t("plugins.reload", "Reload") }),
239
+ /* @__PURE__ */ jsx(Button, { size: "sm", variant: "destructive", onClick: () => confirm(`${t("plugins.uninstall", "Uninstall")} ${info.name}?`) && void run("uninstalling", () => client.uninstall(info.id), () => navigate("/plugins")), children: t("plugins.uninstall", "Uninstall") }),
240
+ /* @__PURE__ */ jsx(PluginSlot, { name: "manager.plugin.actions", props: { plugin: info } })
241
+ ] })
98
242
  ] })
99
243
  ] }),
100
- !!d?.screenshotUrls.length && /* @__PURE__ */ jsxs(Fragment, { children: [
101
- /* @__PURE__ */ jsx("h3", { children: "Screenshots" }),
102
- /* @__PURE__ */ jsx("div", { className: "fluxm-shots", "data-testid": "plugin-shots", children: d.screenshotUrls.map((u) => /* @__PURE__ */ jsx("img", { src: u, alt: "screenshot", onClick: () => setZoom(u) }, u)) })
103
- ] }),
104
- d?.readme && /* @__PURE__ */ jsxs(Fragment, { children: [
105
- /* @__PURE__ */ jsx("h3", { children: "About" }),
106
- /* @__PURE__ */ jsx("div", { "data-testid": "plugin-readme", children: /* @__PURE__ */ jsx(Markdown, { source: d.readme }) })
107
- ] }),
108
- d && Object.keys(d.links).length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
109
- /* @__PURE__ */ jsx("h3", { children: "Links" }),
110
- Object.entries(d.links).map(([k, u]) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("a", { href: u, target: "_blank", rel: "noopener noreferrer", children: k }) }, k))
111
- ] }),
112
- /* @__PURE__ */ jsx("h3", { children: "Permissions" }),
113
- p.permissions.declared.length === 0 && /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: "none requested" }),
114
- p.permissions.declared.map((perm) => {
115
- const on = p.permissions.granted.includes(perm);
116
- return /* @__PURE__ */ jsxs("label", { children: [
117
- /* @__PURE__ */ jsx("input", { type: "checkbox", checked: on, onChange: () => on ? client.revoke(p.id, perm) : client.grant(p.id, perm) }),
118
- perm
119
- ] }, perm);
120
- }),
121
- /* @__PURE__ */ jsxs("div", { children: [
122
- /* @__PURE__ */ jsx("strong", { children: "Dependencies" }),
123
- " ",
124
- /* @__PURE__ */ jsx("span", { className: "fluxm-muted", children: Object.entries(p.dependencies).map(([k, v]) => `${k} ${v}`).join(", ") || "none" })
125
- ] }),
126
- /* @__PURE__ */ jsxs("div", { children: [
127
- /* @__PURE__ */ jsx("strong", { children: "Required by" }),
128
- " ",
129
- /* @__PURE__ */ jsx("span", { className: "fluxm-muted", children: p.dependents.join(", ") || "nobody" })
244
+ info.error && /* @__PURE__ */ jsxs("div", { className: "flux-plugin-error", role: "alert", children: [
245
+ info.error.phase,
246
+ ": ",
247
+ info.error.message
130
248
  ] }),
131
- /* @__PURE__ */ jsx(ConfigForm, { id: p.id }),
132
- /* @__PURE__ */ jsx(PluginSlot, { name: "manager.plugin.details", props: { plugin: p } }),
133
- /* @__PURE__ */ jsx("h3", { children: "Logs" }),
134
- /* @__PURE__ */ jsx("pre", { children: logs.map((l) => `${new Date(l.time).toLocaleTimeString()} ${l.level.toUpperCase()} ${l.message}`).join("\n") || "no logs" }),
135
- zoom && /* @__PURE__ */ jsx("div", { className: "fluxm-zoom", onClick: () => setZoom(void 0), children: /* @__PURE__ */ jsx("img", { src: zoom, alt: "" }) })
249
+ view && /* @__PURE__ */ jsx(Facts, { v: view, extra: [["Runtime", info.state]] }),
250
+ /* @__PURE__ */ jsx("p", { style: { fontSize: "1.1em" }, children: info.description }),
251
+ view ? /* @__PURE__ */ jsx(Body, { v: view, permissionsSlot: (perm) => /* @__PURE__ */ jsx(Switch, { checked: info.permissions.granted.includes(perm), label: perm, onChange: (on) => void (on ? client.grant(info.id, perm) : client.revoke(info.id, perm)) }) }) : /* @__PURE__ */ jsx("div", { className: "flux-loading", children: "\u2026" }),
252
+ /* @__PURE__ */ jsx(ConfigForm, { id: info.id }),
253
+ /* @__PURE__ */ jsx(PluginSlot, { name: "manager.plugin.details", props: { plugin: info } }),
254
+ /* @__PURE__ */ jsx(Logs, { id: info.id, state: info.state })
136
255
  ] });
137
256
  }
138
- function PluginIconLazy({ id }) {
257
+ function StorePluginPage() {
258
+ const t = useT();
139
259
  const { client } = usePluginFramework();
140
- const [url, setUrl] = useState();
260
+ const { id = "" } = useParams();
261
+ const [entry, setEntry] = useState(() => storeCache.find((e) => e.id === id));
262
+ const [err, setErr] = useState("");
263
+ const [busy, setBusy] = useState(false);
141
264
  useEffect(() => {
142
- client.details(id).then((d) => setUrl(d.iconUrl)).catch(() => void 0);
143
- }, [client, id]);
144
- return /* @__PURE__ */ jsx(PluginIcon, { id, url });
145
- }
146
- function PluginManagerUI() {
147
- const { client } = usePluginFramework();
148
- const plugins = usePlugins();
149
- const [tab, setTab] = useState("installed");
150
- const [sel, setSel] = useState();
151
- const [avail, setAvail] = useState([]);
152
- const [storeError, setStoreError] = useState("");
153
- const [loadingStore, setLoadingStore] = useState(false);
154
- const [busy, setBusy] = useState("");
155
- const wrap = useCallback(async (label, fn) => {
156
- setBusy(label);
265
+ if (entry) return;
266
+ client.search(id).then((r) => setEntry(r.find((e) => e.id === id))).catch((e) => setErr(e.message));
267
+ }, [client, id, entry]);
268
+ const install = async () => {
269
+ if (!entry) return;
270
+ setBusy(true);
157
271
  try {
158
- await fn();
272
+ await (entry.installedVersion ? client.update(entry) : client.install(entry));
273
+ navigate("/plugins/" + entry.id);
159
274
  } catch (e) {
160
275
  alert(e.message);
161
276
  } finally {
162
- setBusy("");
277
+ setBusy(false);
163
278
  }
164
- }, []);
279
+ };
280
+ if (!entry) return /* @__PURE__ */ jsxs("div", { className: "flux-pm", children: [
281
+ /* @__PURE__ */ jsxs("button", { className: "flux-pm-back", onClick: back, children: [
282
+ /* @__PURE__ */ jsx(Icon, { name: "back", size: 20 }),
283
+ t("plugins.discover", "Discover")
284
+ ] }),
285
+ err ? /* @__PURE__ */ jsx("div", { className: "flux-plugin-error", children: err }) : /* @__PURE__ */ jsx("div", { className: "flux-loading", children: "\u2026" })
286
+ ] });
287
+ const v = fromEntry(entry);
288
+ const needsUpdate = !!entry.installedVersion && entry.installedVersion !== entry.version;
289
+ return /* @__PURE__ */ jsxs("div", { className: "flux-pm", "data-testid": "store-details", children: [
290
+ /* @__PURE__ */ jsxs("button", { className: "flux-pm-back", onClick: back, "data-testid": "plugin-back", children: [
291
+ /* @__PURE__ */ jsx(Icon, { name: "back", size: 20 }),
292
+ t("plugins.discover", "Discover")
293
+ ] }),
294
+ /* @__PURE__ */ jsxs("div", { className: "flux-pm-hero", children: [
295
+ /* @__PURE__ */ jsx(Icon56, { url: v.iconUrl, base: v.assetBase, large: true }),
296
+ /* @__PURE__ */ jsxs("div", { children: [
297
+ /* @__PURE__ */ jsx("h1", { children: v.name }),
298
+ /* @__PURE__ */ jsxs("div", { className: "by", children: [
299
+ v.author ?? v.id,
300
+ entry.stars ? ` \xB7 \u2605 ${entry.stars}` : "",
301
+ " \xB7 ",
302
+ entry.source
303
+ ] }),
304
+ /* @__PURE__ */ jsxs("div", { className: "flux-pm-actions", children: [
305
+ entry.installedVersion && !needsUpdate ? /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => navigate("/plugins/" + entry.id), children: t("plugins.open", "Open") }) : /* @__PURE__ */ jsx(Button, { variant: "primary", disabled: busy, onClick: () => void install(), "data-testid": "store-install", children: busy ? "\u2026" : needsUpdate ? t("plugins.update", "Update") : t("plugins.get", "Get") }),
306
+ entry.installedVersion && /* @__PURE__ */ jsx("span", { style: { color: "var(--flux-muted)" }, children: t("plugins.installedVersion", "Installed: {v}", { v: entry.installedVersion }) })
307
+ ] })
308
+ ] })
309
+ ] }),
310
+ /* @__PURE__ */ jsx(Facts, { v }),
311
+ /* @__PURE__ */ jsx("p", { style: { fontSize: "1.1em" }, children: v.description }),
312
+ /* @__PURE__ */ jsx(Body, { v })
313
+ ] });
314
+ }
315
+ function PluginsPage() {
316
+ const t = useT();
317
+ const { client } = usePluginFramework();
318
+ const plugins = usePlugins();
319
+ const [tab, setTab] = useState("installed");
320
+ const [q, setQ] = useState("");
321
+ const [entries, setEntries] = useState([]);
322
+ const [error, setError] = useState("");
323
+ const [loading, setLoading] = useState(false);
324
+ const [busy, setBusy] = useState("");
325
+ const timer = useRef(void 0);
165
326
  useEffect(() => {
166
327
  if (tab === "installed") return;
167
328
  let live = true;
168
- setLoadingStore(true);
169
- setStoreError("");
170
- (tab === "available" ? client.search() : client.updates()).then((e) => live && setAvail(e)).catch((e) => live && (setAvail([]), setStoreError(e.message))).finally(() => live && setLoadingStore(false));
329
+ clearTimeout(timer.current);
330
+ timer.current = setTimeout(() => {
331
+ setLoading(true);
332
+ setError("");
333
+ (tab === "discover" ? client.search(q || void 0) : client.updates()).then((e) => {
334
+ if (live) {
335
+ setEntries(e);
336
+ if (tab === "discover") storeCache = e;
337
+ }
338
+ }).catch((e) => live && (setEntries([]), setError(e.message))).finally(() => live && setLoading(false));
339
+ }, tab === "discover" && q ? 350 : 0);
171
340
  return () => {
172
341
  live = false;
173
342
  };
174
- }, [client, tab]);
175
- const selected = plugins.find((p) => p.id === sel);
176
- return /* @__PURE__ */ jsxs("div", { className: "fluxm", children: [
177
- /* @__PURE__ */ jsxs("style", { children: [
178
- css,
179
- css2
343
+ }, [client, tab, q]);
344
+ const installed = useMemo(() => plugins.filter((p) => !q || `${p.name} ${p.id} ${p.description ?? ""}`.toLowerCase().includes(q.toLowerCase())), [plugins, q]);
345
+ const act = useCallback(async (e) => {
346
+ setBusy(e.id);
347
+ try {
348
+ await (e.installedVersion ? client.update(e) : client.install(e));
349
+ setEntries((l) => l.map((x) => x.id === e.id ? { ...x, installedVersion: e.version } : x));
350
+ } catch (err) {
351
+ alert(err.message);
352
+ } finally {
353
+ setBusy("");
354
+ }
355
+ }, [client]);
356
+ return /* @__PURE__ */ jsxs("div", { className: "flux-pm", "data-testid": "plugins-page", children: [
357
+ /* @__PURE__ */ jsx("h1", { className: "flux-large-title", children: t("plugins.title", "Plugins") }),
358
+ /* @__PURE__ */ jsxs("div", { className: "flux-pm-top", children: [
359
+ /* @__PURE__ */ jsx(Segmented, { value: tab, onChange: setTab, label: "Plugins", options: [{ value: "installed", label: t("plugins.installed", "Installed") }, { value: "discover", label: t("plugins.discover", "Discover") }, { value: "updates", label: t("plugins.updates", "Updates") }] }),
360
+ /* @__PURE__ */ jsx("input", { className: "flux-input", style: { maxWidth: 260 }, placeholder: t("plugins.search", "Search plugins"), value: q, onChange: (e) => setQ(e.target.value), "aria-label": "Search plugins" })
180
361
  ] }),
181
- /* @__PURE__ */ jsxs("h2", { children: [
182
- "Plugins ",
183
- busy && /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
184
- busy,
185
- "\u2026"
186
- ] })
362
+ tab === "installed" && /* @__PURE__ */ jsxs(Group, { children: [
363
+ installed.length === 0 && /* @__PURE__ */ jsx(Row, { title: t("plugins.none", "No plugins installed") }),
364
+ installed.map((p) => {
365
+ const [label, cls] = stateLabel(p);
366
+ return /* @__PURE__ */ jsx("div", { "data-plugin": p.id, children: /* @__PURE__ */ jsx(PluginRow, { p, label, cls }) }, p.id);
367
+ })
187
368
  ] }),
188
- /* @__PURE__ */ jsx("div", { className: "fluxm-tabs", children: ["installed", "available", "updates"].map((t) => /* @__PURE__ */ jsx("button", { className: tab === t ? "on" : "", onClick: () => setTab(t), children: t[0].toUpperCase() + t.slice(1) }, t)) }),
189
- tab === "installed" && plugins.map((p) => /* @__PURE__ */ jsxs("div", { className: "fluxm-row", "data-plugin": p.id, children: [
190
- /* @__PURE__ */ jsx(PluginIconLazy, { id: p.id }),
191
- /* @__PURE__ */ jsxs("div", { className: "fluxm-grow", children: [
192
- /* @__PURE__ */ jsx("strong", { children: p.name }),
369
+ tab !== "installed" && loading && /* @__PURE__ */ jsx("div", { className: "flux-loading", children: t("plugins.searching", "Searching the plugin stores\u2026") }),
370
+ tab !== "installed" && error && /* @__PURE__ */ jsx("div", { className: "flux-plugin-error", role: "alert", "data-testid": "store-error", children: error }),
371
+ tab !== "installed" && !loading && !error && entries.length === 0 && /* @__PURE__ */ jsx("div", { className: "flux-empty", "data-testid": "store-empty", children: tab === "updates" ? t("plugins.upToDate", "Everything is up to date.") : t("plugins.storeEmpty", "No plugins found in your stores.") }),
372
+ tab !== "installed" && entries.length > 0 && /* @__PURE__ */ jsx(Group, { children: entries.map((e) => {
373
+ const update = !!e.installedVersion && e.installedVersion !== e.version;
374
+ return /* @__PURE__ */ jsx("div", { "data-store-entry": e.id, children: /* @__PURE__ */ jsx(
375
+ Row,
376
+ {
377
+ onClick: () => navigate("/plugins/store/" + e.id),
378
+ chevron: true,
379
+ icon: /* @__PURE__ */ jsx(Img, { src: e.iconUrl, base: e.location, alt: "", fallback: /* @__PURE__ */ jsx(Icon, { name: "plug", size: 16 }), style: { width: 28, height: 28 } }),
380
+ iconColor: e.iconUrl ? "transparent" : void 0,
381
+ title: /* @__PURE__ */ jsxs(Fragment, { children: [
382
+ e.name,
383
+ " ",
384
+ /* @__PURE__ */ jsxs("span", { style: { color: "var(--flux-muted)", fontWeight: 400 }, children: [
385
+ "v",
386
+ e.version
387
+ ] })
388
+ ] }),
389
+ subtitle: e.description ?? e.id,
390
+ right: e.installedVersion && !update ? /* @__PURE__ */ jsx("span", { className: "flux-pill ok", children: t("plugins.installedTag", "Installed") }) : /* @__PURE__ */ jsx(Button, { size: "sm", variant: "primary", disabled: busy === e.id, onClick: () => void act(e), children: busy === e.id ? "\u2026" : update || tab === "updates" ? t("plugins.update", "Update") : t("plugins.get", "Get") })
391
+ }
392
+ ) }, e.id + e.version);
393
+ }) })
394
+ ] });
395
+ }
396
+ function PluginRow({ p, label, cls }) {
397
+ const { client } = usePluginFramework();
398
+ const t = useT();
399
+ const [url, setUrl] = useState();
400
+ useEffect(() => {
401
+ client.details(p.id).then((d) => setUrl(d.iconUrl)).catch(() => void 0);
402
+ }, [client, p.id, p.version]);
403
+ return /* @__PURE__ */ jsx(
404
+ Row,
405
+ {
406
+ onClick: () => navigate("/plugins/" + p.id),
407
+ chevron: true,
408
+ "data-testid": "row-" + p.id,
409
+ icon: /* @__PURE__ */ jsx(Img, { src: url, alt: "", fallback: /* @__PURE__ */ jsx(Icon, { name: "plug", size: 16 }), style: { width: 28, height: 28 } }),
410
+ iconColor: url ? "transparent" : void 0,
411
+ title: /* @__PURE__ */ jsxs(Fragment, { children: [
412
+ p.name,
193
413
  " ",
194
- /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
414
+ /* @__PURE__ */ jsxs("span", { style: { color: "var(--flux-muted)", fontWeight: 400 }, children: [
195
415
  "v",
196
416
  p.version
197
- ] }),
198
- " ",
199
- badge(p),
200
- /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: p.description })
201
- ] }),
202
- /* @__PURE__ */ jsx(PluginSlot, { name: "manager.plugin.actions", props: { plugin: p } }),
203
- /* @__PURE__ */ jsx("button", { onClick: () => setSel(p.id), children: "Details" }),
204
- /* @__PURE__ */ jsx("button", { onClick: () => wrap("reloading", () => client.reload(p.id)), children: "Reload" }),
205
- p.enabled ? /* @__PURE__ */ jsx("button", { onClick: () => wrap("disabling", () => client.disable(p.id)), children: "Disable" }) : /* @__PURE__ */ jsx("button", { className: "on", onClick: () => wrap("enabling", () => client.enable(p.id)), children: "Enable" }),
206
- /* @__PURE__ */ jsx("button", { className: "danger", onClick: () => confirm(`Uninstall ${p.name}?`) && wrap("uninstalling", () => client.uninstall(p.id)), children: "Uninstall" })
207
- ] }, p.id)),
208
- tab !== "installed" && loadingStore && /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: "Searching the plugin stores\u2026" }),
209
- tab !== "installed" && storeError && /* @__PURE__ */ jsx("div", { className: "fluxm-error fluxm-badge", role: "alert", "data-testid": "store-error", children: storeError }),
210
- tab !== "installed" && !loadingStore && !storeError && avail.length === 0 && /* @__PURE__ */ jsx("div", { className: "fluxm-muted", "data-testid": "store-empty", children: tab === "updates" ? "Everything is up to date." : "No plugins found. Plugins published with `fluxplugin publish` appear here; you can add your own store in fluxplugin.config.json." }),
211
- tab !== "installed" && avail.map((e) => /* @__PURE__ */ jsxs("div", { className: "fluxm-row", "data-store-entry": e.id, children: [
212
- /* @__PURE__ */ jsxs("div", { className: "fluxm-grow", children: [
213
- /* @__PURE__ */ jsx("strong", { children: e.name }),
214
- " ",
215
- /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
216
- "v",
217
- e.version,
218
- e.stars ? ` \xB7 \u2605 ${e.stars}` : "",
219
- " \xB7 ",
220
- e.source
221
- ] }),
222
- /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: e.description }),
223
- /* @__PURE__ */ jsxs("div", { className: "fluxm-muted", children: [
224
- "asks for: ",
225
- e.permissions.join(", ") || "no permissions",
226
- e.homepage ? /* @__PURE__ */ jsxs(Fragment, { children: [
227
- " \xB7 ",
228
- /* @__PURE__ */ jsx("a", { href: e.homepage, target: "_blank", rel: "noopener noreferrer", children: "source" })
229
- ] }) : null
230
417
  ] })
231
418
  ] }),
232
- /* @__PURE__ */ jsx("button", { className: "on", onClick: () => wrap("installing", () => tab === "updates" ? client.update(e) : client.install(e)), children: tab === "updates" ? "Update" : "Install" })
233
- ] }, e.id + e.version)),
234
- selected && /* @__PURE__ */ jsx(Details, { p: selected, onClose: () => setSel(void 0) })
235
- ] });
419
+ subtitle: p.description ?? p.id,
420
+ right: /* @__PURE__ */ jsxs(Fragment, { children: [
421
+ /* @__PURE__ */ jsx("span", { className: "flux-pill " + cls, children: t(`state.${p.state}`, label) }),
422
+ /* @__PURE__ */ jsx(Switch, { checked: p.enabled, label: p.name, onChange: (on) => void (on ? client.enable(p.id) : client.disable(p.id)) })
423
+ ] })
424
+ }
425
+ );
426
+ }
427
+ function registerPluginManagerRoutes(framework) {
428
+ const r = framework.manager.routes;
429
+ r.register({ path: "/plugins", component: PluginsPage, meta: { title: "Plugins", breadcrumb: "Plugins" } }, "host");
430
+ r.register({ path: "/plugins/:id", component: PluginDetailsPage, meta: { breadcrumb: (p) => p["id"] ?? "" } }, "host");
431
+ r.register({ path: "/plugins/store/:id", component: StorePluginPage, meta: { breadcrumb: (p) => p["id"] ?? "" } }, "host");
236
432
  }
433
+ var PluginManagerUI = PluginsPage;
237
434
  export {
238
435
  ConfigForm,
239
- PluginManagerUI
436
+ PluginDetailsPage,
437
+ PluginManagerUI,
438
+ PluginsPage,
439
+ StorePluginPage,
440
+ registerPluginManagerRoutes
240
441
  };