fluxplugin 1.0.1 → 1.0.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.
Files changed (62) hide show
  1. package/README.md +22 -9
  2. package/dist/{node/chunks/chunk-XPLGAEBH.js → browser/chunks/chunk-TL63576R.js} +106 -81
  3. package/dist/browser/chunks/{chunk-ZZ25CRMR.js → chunk-VXQJIDXW.js} +479 -6
  4. package/dist/browser/index.js +5 -1
  5. package/dist/browser/manager-ui.js +93 -18
  6. package/dist/browser/react.js +34 -4
  7. package/dist/cli.js +869 -174
  8. package/dist/node/chunks/chunk-3FH6NAJG.js +38 -0
  9. package/dist/node/chunks/{chunk-BZ7NZF7I.js → chunk-C7VWZZOX.js} +259 -44
  10. package/dist/{browser/chunks/chunk-Q75AOCXD.js → node/chunks/chunk-EVX2O65A.js} +185 -2
  11. package/dist/node/chunks/chunk-WSFCRVEQ.js +9 -0
  12. package/dist/node/chunks/tailwind-TJQVTBG5.js +9 -0
  13. package/dist/node/cli-api.js +562 -129
  14. package/dist/node/index.js +6 -1
  15. package/dist/node/main.js +19 -2
  16. package/dist/node/preload.js +2 -1
  17. package/dist/types/cli/build.d.ts +1 -1
  18. package/dist/types/cli/config.d.ts +3 -0
  19. package/dist/types/cli/host-files.generated.d.ts +1 -0
  20. package/dist/types/cli/host-templates.d.ts +3 -0
  21. package/dist/types/cli/host.d.ts +8 -0
  22. package/dist/types/cli/package.d.ts +18 -0
  23. package/dist/types/cli/publish.d.ts +23 -0
  24. package/dist/types/cli/store.d.ts +7 -0
  25. package/dist/types/cli/tailwind.d.ts +10 -0
  26. package/dist/types/cli/templates.d.ts +2 -0
  27. package/dist/types/core/index.d.ts +1 -0
  28. package/dist/types/core/manager.d.ts +2 -0
  29. package/dist/types/core/manifest.d.ts +9 -0
  30. package/dist/types/core/notifications.d.ts +48 -0
  31. package/dist/types/core/plugin.d.ts +7 -0
  32. package/dist/types/core/protocol.d.ts +27 -0
  33. package/dist/types/main/framework.d.ts +7 -1
  34. package/dist/types/main/github-registry.d.ts +49 -0
  35. package/dist/types/main/index.d.ts +2 -0
  36. package/dist/types/main/registry.d.ts +30 -0
  37. package/dist/types/main/stores.d.ts +29 -0
  38. package/dist/types/react/base-css.d.ts +1 -1
  39. package/dist/types/react/icons.d.ts +12 -0
  40. package/dist/types/react/index.d.ts +5 -0
  41. package/dist/types/react/markdown.d.ts +8 -0
  42. package/dist/types/react/os.d.ts +5 -0
  43. package/dist/types/react/runtime.d.ts +2 -1
  44. package/dist/types/react/theme.d.ts +53 -0
  45. package/dist/types/react/titlebar.d.ts +28 -0
  46. package/docs/CUSTOMIZING.md +257 -0
  47. package/docs/PLUGIN-AUTHORS.md +36 -9
  48. package/docs/RELEASE.md +1 -1
  49. package/docs/SECURITY.md +5 -0
  50. package/docs/STORE.md +123 -0
  51. package/docs/TROUBLESHOOTING.md +35 -0
  52. package/docs/screenshots/command-palette.png +0 -0
  53. package/docs/screenshots/dashboard.png +0 -0
  54. package/docs/screenshots/electron-plugin-page.png +0 -0
  55. package/docs/screenshots/electron-titlebar.png +0 -0
  56. package/docs/screenshots/plugin-details.png +0 -0
  57. package/docs/screenshots/plugin-manager.png +0 -0
  58. package/docs/screenshots/plugin-video.png +0 -0
  59. package/docs/screenshots/stats.png +0 -0
  60. package/docs/screenshots/store-available.png +0 -0
  61. package/docs/screenshots/tailwind-dark.png +0 -0
  62. package/package.json +1 -1
@@ -1,13 +1,15 @@
1
1
  import {
2
+ Icon,
3
+ Markdown,
2
4
  PluginSlot,
3
5
  usePluginFramework,
4
6
  usePlugins
5
- } from "./chunks/chunk-ZZ25CRMR.js";
6
- import "./chunks/chunk-Q75AOCXD.js";
7
+ } from "./chunks/chunk-VXQJIDXW.js";
8
+ import "./chunks/chunk-TL63576R.js";
7
9
 
8
10
  // src/manager-ui/index.tsx
9
11
  import { useCallback, useEffect, useState } from "react";
10
- import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
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}
12
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}
13
15
  .fluxm button.on{background:var(--flux-accent,#4f46e5);color:#fff;border-color:transparent}.fluxm button.danger{color:#dc2626}
@@ -38,32 +40,76 @@ function ConfigForm({ id }) {
38
40
  /* @__PURE__ */ jsx("button", { onClick: () => client.configReset(id).then(setValues), children: "Reset to defaults" })
39
41
  ] });
40
42
  }
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
+ }
41
52
  function Details({ p, onClose }) {
42
53
  const { client } = usePluginFramework();
43
54
  const [logs, setLogs] = useState([]);
55
+ const [d, setD] = useState();
56
+ const [zoom, setZoom] = useState();
44
57
  useEffect(() => {
45
58
  client.logs(p.id).then(setLogs).catch(() => void 0);
46
59
  }, [client, p.id, p.state]);
60
+ useEffect(() => {
61
+ setD(void 0);
62
+ client.details(p.id).then(setD).catch(() => void 0);
63
+ }, [client, p.id, p.version]);
47
64
  return /* @__PURE__ */ jsxs("div", { className: "fluxm-panel", "data-testid": "plugin-details", children: [
48
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between" }, children: [
49
- /* @__PURE__ */ jsxs("strong", { children: [
50
- p.name,
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 }),
51
69
  " ",
52
70
  /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
53
71
  p.id,
54
72
  "@",
55
73
  p.version
56
- ] })
74
+ ] }),
75
+ /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: [d?.author, d?.license].filter(Boolean).join(" \xB7 ") })
57
76
  ] }),
58
77
  /* @__PURE__ */ jsx("button", { onClick: onClose, children: "Close" })
59
78
  ] }),
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))
85
+ ] }),
86
+ d?.bannerUrl && /* @__PURE__ */ jsx("img", { className: "fluxm-banner", src: d.bannerUrl, alt: "" }),
60
87
  /* @__PURE__ */ jsx("p", { children: p.description }),
61
88
  p.error && /* @__PURE__ */ jsxs("p", { className: "fluxm-error fluxm-badge", children: [
62
89
  p.error.phase,
63
90
  ": ",
64
91
  p.error.message
65
92
  ] }),
66
- /* @__PURE__ */ jsx("strong", { children: "Permissions" }),
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"
98
+ ] })
99
+ ] }),
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" }),
67
113
  p.permissions.declared.length === 0 && /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: "none requested" }),
68
114
  p.permissions.declared.map((perm) => {
69
115
  const on = p.permissions.granted.includes(perm);
@@ -84,16 +130,27 @@ function Details({ p, onClose }) {
84
130
  ] }),
85
131
  /* @__PURE__ */ jsx(ConfigForm, { id: p.id }),
86
132
  /* @__PURE__ */ jsx(PluginSlot, { name: "manager.plugin.details", props: { plugin: p } }),
87
- /* @__PURE__ */ jsx("strong", { children: "Logs" }),
88
- /* @__PURE__ */ jsx("pre", { children: logs.map((l) => `${new Date(l.time).toLocaleTimeString()} ${l.level.toUpperCase()} ${l.message}`).join("\n") || "no logs" })
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: "" }) })
89
136
  ] });
90
137
  }
138
+ function PluginIconLazy({ id }) {
139
+ const { client } = usePluginFramework();
140
+ const [url, setUrl] = useState();
141
+ useEffect(() => {
142
+ client.details(id).then((d) => setUrl(d.iconUrl)).catch(() => void 0);
143
+ }, [client, id]);
144
+ return /* @__PURE__ */ jsx(PluginIcon, { id, url });
145
+ }
91
146
  function PluginManagerUI() {
92
147
  const { client } = usePluginFramework();
93
148
  const plugins = usePlugins();
94
149
  const [tab, setTab] = useState("installed");
95
150
  const [sel, setSel] = useState();
96
151
  const [avail, setAvail] = useState([]);
152
+ const [storeError, setStoreError] = useState("");
153
+ const [loadingStore, setLoadingStore] = useState(false);
97
154
  const [busy, setBusy] = useState("");
98
155
  const wrap = useCallback(async (label, fn) => {
99
156
  setBusy(label);
@@ -106,12 +163,21 @@ function PluginManagerUI() {
106
163
  }
107
164
  }, []);
108
165
  useEffect(() => {
109
- if (tab === "available") client.search().then(setAvail).catch(() => setAvail([]));
110
- if (tab === "updates") client.updates().then(setAvail).catch(() => setAvail([]));
166
+ if (tab === "installed") return;
167
+ 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));
171
+ return () => {
172
+ live = false;
173
+ };
111
174
  }, [client, tab]);
112
175
  const selected = plugins.find((p) => p.id === sel);
113
176
  return /* @__PURE__ */ jsxs("div", { className: "fluxm", children: [
114
- /* @__PURE__ */ jsx("style", { children: css }),
177
+ /* @__PURE__ */ jsxs("style", { children: [
178
+ css,
179
+ css2
180
+ ] }),
115
181
  /* @__PURE__ */ jsxs("h2", { children: [
116
182
  "Plugins ",
117
183
  busy && /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
@@ -121,6 +187,7 @@ function PluginManagerUI() {
121
187
  ] }),
122
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)) }),
123
189
  tab === "installed" && plugins.map((p) => /* @__PURE__ */ jsxs("div", { className: "fluxm-row", "data-plugin": p.id, children: [
190
+ /* @__PURE__ */ jsx(PluginIconLazy, { id: p.id }),
124
191
  /* @__PURE__ */ jsxs("div", { className: "fluxm-grow", children: [
125
192
  /* @__PURE__ */ jsx("strong", { children: p.name }),
126
193
  " ",
@@ -138,24 +205,32 @@ function PluginManagerUI() {
138
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" }),
139
206
  /* @__PURE__ */ jsx("button", { className: "danger", onClick: () => confirm(`Uninstall ${p.name}?`) && wrap("uninstalling", () => client.uninstall(p.id)), children: "Uninstall" })
140
207
  ] }, p.id)),
141
- tab !== "installed" && (avail.length === 0 ? /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: "Nothing here. Configure a registry in the host." }) : avail.map((e) => /* @__PURE__ */ jsxs("div", { className: "fluxm-row", children: [
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: [
142
212
  /* @__PURE__ */ jsxs("div", { className: "fluxm-grow", children: [
143
213
  /* @__PURE__ */ jsx("strong", { children: e.name }),
144
214
  " ",
145
215
  /* @__PURE__ */ jsxs("span", { className: "fluxm-muted", children: [
146
216
  "v",
147
217
  e.version,
218
+ e.stars ? ` \xB7 \u2605 ${e.stars}` : "",
148
219
  " \xB7 ",
149
220
  e.source
150
221
  ] }),
222
+ /* @__PURE__ */ jsx("div", { className: "fluxm-muted", children: e.description }),
151
223
  /* @__PURE__ */ jsxs("div", { className: "fluxm-muted", children: [
152
- e.description,
153
- " \xB7 permissions: ",
154
- e.permissions.join(", ") || "none"
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
155
230
  ] })
156
231
  ] }),
157
232
  /* @__PURE__ */ jsx("button", { className: "on", onClick: () => wrap("installing", () => tab === "updates" ? client.update(e) : client.install(e)), children: tab === "updates" ? "Update" : "Install" })
158
- ] }, e.id + e.version))),
233
+ ] }, e.id + e.version)),
159
234
  selected && /* @__PURE__ */ jsx(Details, { p: selected, onClose: () => setSel(void 0) })
160
235
  ] });
161
236
  }
@@ -1,8 +1,12 @@
1
1
  import {
2
+ AppMenuBar,
2
3
  Breadcrumbs,
3
4
  CommandPalette,
4
5
  HttpBridgeError,
6
+ Icon,
5
7
  Link,
8
+ Markdown,
9
+ NotificationBell,
6
10
  PluginBoundary,
7
11
  PluginErrorBoundary,
8
12
  PluginProvider,
@@ -11,10 +15,19 @@ import {
11
15
  PluginsClient,
12
16
  RemoteError,
13
17
  RendererFramework,
18
+ SearchBox,
14
19
  StyleHost,
20
+ ThemeProvider,
21
+ ThemeSwitcher,
22
+ TitleBar,
23
+ ToastHost,
15
24
  baseCss,
16
25
  buildPluginApis,
17
26
  createHttpBridge,
27
+ declareHostPoints,
28
+ detectOS,
29
+ formatShortcut,
30
+ iconNames,
18
31
  installSharedModules,
19
32
  navigate,
20
33
  useExtensionItems,
@@ -22,6 +35,7 @@ import {
22
35
  useLocation,
23
36
  useMenu,
24
37
  useNavigate,
38
+ useOS,
25
39
  useParams,
26
40
  usePlugin,
27
41
  usePluginCommand,
@@ -32,14 +46,19 @@ import {
32
46
  usePluginRoute,
33
47
  usePluginService,
34
48
  usePluginState,
35
- usePlugins
36
- } from "./chunks/chunk-ZZ25CRMR.js";
37
- import "./chunks/chunk-Q75AOCXD.js";
49
+ usePlugins,
50
+ useTheme
51
+ } from "./chunks/chunk-VXQJIDXW.js";
52
+ import "./chunks/chunk-TL63576R.js";
38
53
  export {
54
+ AppMenuBar,
39
55
  Breadcrumbs,
40
56
  CommandPalette,
41
57
  HttpBridgeError,
58
+ Icon,
42
59
  Link,
60
+ Markdown,
61
+ NotificationBell,
43
62
  PluginBoundary,
44
63
  PluginErrorBoundary,
45
64
  PluginProvider,
@@ -48,10 +67,19 @@ export {
48
67
  PluginsClient,
49
68
  RemoteError,
50
69
  RendererFramework,
70
+ SearchBox,
51
71
  StyleHost,
72
+ ThemeProvider,
73
+ ThemeSwitcher,
74
+ TitleBar,
75
+ ToastHost,
52
76
  baseCss,
53
77
  buildPluginApis,
54
78
  createHttpBridge,
79
+ declareHostPoints,
80
+ detectOS,
81
+ formatShortcut,
82
+ iconNames,
55
83
  installSharedModules,
56
84
  navigate,
57
85
  useExtensionItems,
@@ -59,6 +87,7 @@ export {
59
87
  useLocation,
60
88
  useMenu,
61
89
  useNavigate,
90
+ useOS,
62
91
  useParams,
63
92
  usePlugin,
64
93
  usePluginCommand,
@@ -69,5 +98,6 @@ export {
69
98
  usePluginRoute,
70
99
  usePluginService,
71
100
  usePluginState,
72
- usePlugins
101
+ usePlugins,
102
+ useTheme
73
103
  };