fluxplugin 1.0.0 → 1.0.2
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/README.md +35 -10
- package/dist/{node/chunks/chunk-XPLGAEBH.js → browser/chunks/chunk-TL63576R.js} +106 -81
- package/dist/browser/chunks/{chunk-ZZ25CRMR.js → chunk-VXQJIDXW.js} +479 -6
- package/dist/browser/index.js +5 -1
- package/dist/browser/manager-ui.js +93 -18
- package/dist/browser/react.js +34 -4
- package/dist/cli.js +955 -318
- package/dist/node/chunks/chunk-3FH6NAJG.js +38 -0
- package/dist/node/chunks/{chunk-BZ7NZF7I.js → chunk-C7VWZZOX.js} +259 -44
- package/dist/{browser/chunks/chunk-Q75AOCXD.js → node/chunks/chunk-EVX2O65A.js} +185 -2
- package/dist/node/chunks/chunk-WSFCRVEQ.js +9 -0
- package/dist/node/chunks/tailwind-TJQVTBG5.js +9 -0
- package/dist/node/cli-api.js +663 -288
- package/dist/node/index.js +6 -1
- package/dist/node/main.js +19 -2
- package/dist/node/preload.js +2 -1
- package/dist/types/cli/build.d.ts +1 -1
- package/dist/types/cli/config.d.ts +3 -0
- package/dist/types/cli/host-files.generated.d.ts +2 -0
- package/dist/types/cli/host-templates.d.ts +3 -0
- package/dist/types/cli/host.d.ts +10 -1
- package/dist/types/cli/package.d.ts +18 -0
- package/dist/types/cli/publish.d.ts +23 -0
- package/dist/types/cli/store.d.ts +7 -0
- package/dist/types/cli/tailwind.d.ts +10 -0
- package/dist/types/cli/templates.d.ts +2 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/manager.d.ts +2 -0
- package/dist/types/core/manifest.d.ts +9 -0
- package/dist/types/core/notifications.d.ts +48 -0
- package/dist/types/core/plugin.d.ts +7 -0
- package/dist/types/core/protocol.d.ts +27 -0
- package/dist/types/main/framework.d.ts +7 -1
- package/dist/types/main/github-registry.d.ts +49 -0
- package/dist/types/main/index.d.ts +2 -0
- package/dist/types/main/registry.d.ts +30 -0
- package/dist/types/main/stores.d.ts +29 -0
- package/dist/types/react/base-css.d.ts +1 -1
- package/dist/types/react/icons.d.ts +12 -0
- package/dist/types/react/index.d.ts +5 -0
- package/dist/types/react/markdown.d.ts +8 -0
- package/dist/types/react/os.d.ts +5 -0
- package/dist/types/react/runtime.d.ts +2 -1
- package/dist/types/react/theme.d.ts +53 -0
- package/dist/types/react/titlebar.d.ts +28 -0
- package/docs/CUSTOMIZING.md +257 -0
- package/docs/PLUGIN-AUTHORS.md +36 -9
- package/docs/RELEASE.md +1 -1
- package/docs/SECURITY.md +5 -0
- package/docs/STORE.md +123 -0
- package/docs/TROUBLESHOOTING.md +35 -0
- package/docs/screenshots/command-palette.png +0 -0
- package/docs/screenshots/dashboard.png +0 -0
- package/docs/screenshots/electron-app.png +0 -0
- package/docs/screenshots/electron-plugin-page.png +0 -0
- package/docs/screenshots/electron-titlebar.png +0 -0
- package/docs/screenshots/plugin-details.png +0 -0
- package/docs/screenshots/plugin-manager.png +0 -0
- package/docs/screenshots/plugin-video.png +0 -0
- package/docs/screenshots/stats.png +0 -0
- package/docs/screenshots/store-available.png +0 -0
- package/docs/screenshots/tailwind-dark.png +0 -0
- package/package.json +1 -2
|
@@ -1,3 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-WSFCRVEQ.js";
|
|
4
|
+
|
|
5
|
+
// src/core/index.ts
|
|
6
|
+
var core_exports = {};
|
|
7
|
+
__export(core_exports, {
|
|
8
|
+
BUILTIN_PERMISSIONS: () => BUILTIN_PERMISSIONS,
|
|
9
|
+
CHANNELS: () => CHANNELS,
|
|
10
|
+
CommandRegistry: () => CommandRegistry,
|
|
11
|
+
DisposableStore: () => DisposableStore,
|
|
12
|
+
EventBus: () => EventBus,
|
|
13
|
+
ExtensionPointRegistry: () => ExtensionPointRegistry,
|
|
14
|
+
FRAMEWORK_ENGINE_KEY: () => FRAMEWORK_ENGINE_KEY,
|
|
15
|
+
FRAMEWORK_VERSION: () => FRAMEWORK_VERSION,
|
|
16
|
+
FrameworkError: () => FrameworkError,
|
|
17
|
+
HookCancelledError: () => HookCancelledError,
|
|
18
|
+
HookSystem: () => HookSystem,
|
|
19
|
+
IpcError: () => IpcError,
|
|
20
|
+
IpcRegistry: () => IpcRegistry,
|
|
21
|
+
LifecycleError: () => LifecycleError,
|
|
22
|
+
LogStore: () => LogStore,
|
|
23
|
+
MGMT: () => MGMT,
|
|
24
|
+
MemoryStorageBackend: () => MemoryStorageBackend,
|
|
25
|
+
MenuRegistry: () => MenuRegistry,
|
|
26
|
+
NotificationCenter: () => NotificationCenter,
|
|
27
|
+
PermissionDeniedError: () => PermissionDeniedError,
|
|
28
|
+
PermissionManager: () => PermissionManager,
|
|
29
|
+
PluginManager: () => PluginManager,
|
|
30
|
+
PreloadRegistry: () => PreloadRegistry,
|
|
31
|
+
Registry: () => Registry,
|
|
32
|
+
RouteRegistry: () => RouteRegistry,
|
|
33
|
+
ServiceRegistry: () => ServiceRegistry,
|
|
34
|
+
SlotRegistry: () => SlotRegistry,
|
|
35
|
+
StyleRegistry: () => StyleRegistry,
|
|
36
|
+
TimeoutError: () => TimeoutError,
|
|
37
|
+
ValidationError: () => ValidationError,
|
|
38
|
+
activationOrderFor: () => activationOrderFor,
|
|
39
|
+
buildDependencyGraph: () => buildDependencyGraph,
|
|
40
|
+
compareVersions: () => compareVersions,
|
|
41
|
+
createPluginConfig: () => createPluginConfig,
|
|
42
|
+
createPluginState: () => createPluginState,
|
|
43
|
+
createPluginStorage: () => createPluginStorage,
|
|
44
|
+
defineCommand: () => defineCommand,
|
|
45
|
+
defineComponent: () => defineComponent,
|
|
46
|
+
defineEvent: () => defineEvent,
|
|
47
|
+
defineHook: () => defineHook,
|
|
48
|
+
defineIPC: () => defineIPC,
|
|
49
|
+
defineIpcContract: () => defineIpcContract,
|
|
50
|
+
defineMenu: () => defineMenu,
|
|
51
|
+
definePlugin: () => definePlugin,
|
|
52
|
+
defineRoute: () => defineRoute,
|
|
53
|
+
defineService: () => defineService,
|
|
54
|
+
dependentsOf: () => dependentsOf,
|
|
55
|
+
describeIssue: () => describeIssue,
|
|
56
|
+
errorMessage: () => errorMessage,
|
|
57
|
+
hasPluginApi: () => hasPluginApi,
|
|
58
|
+
isValidRange: () => isValidRange,
|
|
59
|
+
isValidVersion: () => isValidVersion,
|
|
60
|
+
manifestSchema: () => manifestSchema,
|
|
61
|
+
matchesPattern: () => matchesPattern,
|
|
62
|
+
menuLocations: () => menuLocations,
|
|
63
|
+
normalizePath: () => normalizePath,
|
|
64
|
+
parseOrThrow: () => parseOrThrow,
|
|
65
|
+
parseVersion: () => parseVersion,
|
|
66
|
+
pluginApi: () => pluginApi,
|
|
67
|
+
preloadMember: () => preloadMember,
|
|
68
|
+
routePatternMatches: () => routePatternMatches,
|
|
69
|
+
s: () => s,
|
|
70
|
+
satisfies: () => satisfies,
|
|
71
|
+
scopeCss: () => scopeCss,
|
|
72
|
+
serializeError: () => serializeError,
|
|
73
|
+
toDisposable: () => toDisposable,
|
|
74
|
+
validateManifest: () => validateManifest,
|
|
75
|
+
videoEmbedUrl: () => videoEmbedUrl,
|
|
76
|
+
withTimeout: () => withTimeout
|
|
77
|
+
});
|
|
78
|
+
|
|
1
79
|
// src/core/common.ts
|
|
2
80
|
var toDisposable = (fn) => {
|
|
3
81
|
let done = false;
|
|
@@ -525,6 +603,18 @@ var manifestSchema = s.object({
|
|
|
525
603
|
repository: s.union(s.string(), s.object({ type: s.string().optional(), url: s.string() })).optional(),
|
|
526
604
|
license: s.string().optional(),
|
|
527
605
|
icon: s.string().optional(),
|
|
606
|
+
/** Wide image shown at the top of the plugin page (png/jpg/webp/svg inside the plugin). */
|
|
607
|
+
banner: s.string().optional(),
|
|
608
|
+
/** Screenshots shown in a gallery (paths inside the plugin). */
|
|
609
|
+
screenshots: s.array(s.string()).default([]),
|
|
610
|
+
/** Detailed description as Markdown (default: ./README.md). Rendered safely: no raw HTML. */
|
|
611
|
+
readme: s.string().optional(),
|
|
612
|
+
/** Explanation video (https URL; YouTube and Vimeo are embedded, other hosts become a link). */
|
|
613
|
+
video: s.string({ pattern: /^https:\/\/\S+$/ }).optional(),
|
|
614
|
+
categories: s.array(s.string()).default([]),
|
|
615
|
+
keywords: s.array(s.string()).default([]),
|
|
616
|
+
/** Extra links: docs, support, changelog, funding... */
|
|
617
|
+
links: s.record(s.string({ pattern: /^https:\/\/\S+$/ })).default({}),
|
|
528
618
|
/** Entry executed in the Electron main process. */
|
|
529
619
|
main: s.string().optional(),
|
|
530
620
|
/** Entry executed in the preload context (sandbox-compatible, no Node). */
|
|
@@ -581,6 +671,25 @@ function validateManifest(raw, opts = {}) {
|
|
|
581
671
|
}
|
|
582
672
|
return { ok: issues.length === 0, manifest: issues.length ? void 0 : manifest, issues, warnings };
|
|
583
673
|
}
|
|
674
|
+
function videoEmbedUrl(url) {
|
|
675
|
+
if (!url) return void 0;
|
|
676
|
+
let u;
|
|
677
|
+
try {
|
|
678
|
+
u = new URL(url);
|
|
679
|
+
} catch {
|
|
680
|
+
return void 0;
|
|
681
|
+
}
|
|
682
|
+
const host = u.hostname.replace(/^www\./, "");
|
|
683
|
+
let id;
|
|
684
|
+
if (host === "youtu.be") id = u.pathname.slice(1);
|
|
685
|
+
else if (host === "youtube.com" || host === "m.youtube.com") id = u.searchParams.get("v") ?? (/^\/(embed|shorts)\//.test(u.pathname) ? u.pathname.split("/")[2] : void 0);
|
|
686
|
+
if (id && /^[\w-]{6,20}$/.test(id)) return `https://www.youtube-nocookie.com/embed/${id}`;
|
|
687
|
+
if (host === "vimeo.com" || host === "player.vimeo.com") {
|
|
688
|
+
const vid = u.pathname.split("/").filter(Boolean).pop();
|
|
689
|
+
if (vid && /^\d+$/.test(vid)) return `https://player.vimeo.com/video/${vid}`;
|
|
690
|
+
}
|
|
691
|
+
return void 0;
|
|
692
|
+
}
|
|
584
693
|
|
|
585
694
|
// src/core/events.ts
|
|
586
695
|
function matchesPattern(pattern, name) {
|
|
@@ -1717,6 +1826,70 @@ var defineEvent = (name, handler, opts = {}) => ({ name, handler, ...opts });
|
|
|
1717
1826
|
var defineComponent = (c) => c;
|
|
1718
1827
|
var defineMenu = (m) => m;
|
|
1719
1828
|
|
|
1829
|
+
// src/core/notifications.ts
|
|
1830
|
+
var NotificationCenter = class {
|
|
1831
|
+
constructor(capacity = 200) {
|
|
1832
|
+
this.capacity = capacity;
|
|
1833
|
+
}
|
|
1834
|
+
capacity;
|
|
1835
|
+
items = [];
|
|
1836
|
+
listeners = /* @__PURE__ */ new Set();
|
|
1837
|
+
pushListeners = /* @__PURE__ */ new Set();
|
|
1838
|
+
seq = 0;
|
|
1839
|
+
version = 0;
|
|
1840
|
+
push(input, owner = "host") {
|
|
1841
|
+
const id = input.id ?? `${owner}#${Date.now().toString(36)}-${this.seq++}`;
|
|
1842
|
+
this.items = this.items.filter((n) => n.id !== id);
|
|
1843
|
+
const item = {
|
|
1844
|
+
id,
|
|
1845
|
+
title: input.title,
|
|
1846
|
+
body: input.body,
|
|
1847
|
+
level: input.level ?? "info",
|
|
1848
|
+
actions: input.actions ?? [],
|
|
1849
|
+
timeoutMs: input.timeoutMs ?? 5e3,
|
|
1850
|
+
owner,
|
|
1851
|
+
time: Date.now(),
|
|
1852
|
+
read: false
|
|
1853
|
+
};
|
|
1854
|
+
this.items.unshift(item);
|
|
1855
|
+
if (this.items.length > this.capacity) this.items.length = this.capacity;
|
|
1856
|
+
this.changed();
|
|
1857
|
+
for (const l of [...this.pushListeners]) l(item);
|
|
1858
|
+
return { id, dismiss: () => this.dismiss(id) };
|
|
1859
|
+
}
|
|
1860
|
+
list() {
|
|
1861
|
+
return this.items;
|
|
1862
|
+
}
|
|
1863
|
+
get unread() {
|
|
1864
|
+
return this.items.filter((n) => !n.read).length;
|
|
1865
|
+
}
|
|
1866
|
+
markRead(id) {
|
|
1867
|
+
for (const n of this.items) if (!id || n.id === id) n.read = true;
|
|
1868
|
+
this.changed();
|
|
1869
|
+
}
|
|
1870
|
+
dismiss(id) {
|
|
1871
|
+
this.items = this.items.filter((n) => n.id !== id);
|
|
1872
|
+
this.changed();
|
|
1873
|
+
}
|
|
1874
|
+
clear() {
|
|
1875
|
+
this.items = [];
|
|
1876
|
+
this.changed();
|
|
1877
|
+
}
|
|
1878
|
+
subscribe = (l) => {
|
|
1879
|
+
this.listeners.add(l);
|
|
1880
|
+
return () => void this.listeners.delete(l);
|
|
1881
|
+
};
|
|
1882
|
+
/** Called for every new notification (toast host, native bridges, main→renderer forwarding). */
|
|
1883
|
+
onPush(l) {
|
|
1884
|
+
this.pushListeners.add(l);
|
|
1885
|
+
return toDisposable(() => this.pushListeners.delete(l));
|
|
1886
|
+
}
|
|
1887
|
+
changed() {
|
|
1888
|
+
this.version++;
|
|
1889
|
+
for (const l of [...this.listeners]) l();
|
|
1890
|
+
}
|
|
1891
|
+
};
|
|
1892
|
+
|
|
1720
1893
|
// src/core/manager.ts
|
|
1721
1894
|
var DEFAULT_TIMEOUTS = { load: 15e3, initialize: 1e4, activate: 15e3, ready: 1e4, deactivate: 1e4, unload: 1e4 };
|
|
1722
1895
|
var PluginManager = class {
|
|
@@ -1748,6 +1921,7 @@ var PluginManager = class {
|
|
|
1748
1921
|
ipc = new IpcRegistry();
|
|
1749
1922
|
preload = new PreloadRegistry();
|
|
1750
1923
|
styles = new StyleRegistry();
|
|
1924
|
+
notifications = new NotificationCenter();
|
|
1751
1925
|
storageBackend;
|
|
1752
1926
|
records = /* @__PURE__ */ new Map();
|
|
1753
1927
|
states = /* @__PURE__ */ new Map();
|
|
@@ -1811,7 +1985,11 @@ var PluginManager = class {
|
|
|
1811
1985
|
optionalDependencies: {},
|
|
1812
1986
|
peerDependencies: {},
|
|
1813
1987
|
engines: {},
|
|
1814
|
-
contributes: {}
|
|
1988
|
+
contributes: {},
|
|
1989
|
+
screenshots: [],
|
|
1990
|
+
categories: [],
|
|
1991
|
+
keywords: [],
|
|
1992
|
+
links: {}
|
|
1815
1993
|
};
|
|
1816
1994
|
const rec = {
|
|
1817
1995
|
id,
|
|
@@ -2394,6 +2572,7 @@ var PluginManager = class {
|
|
|
2394
2572
|
run: (op, input, exec) => (need("hooks", "hooks.run"), this.hooks.run(op, input, exec)),
|
|
2395
2573
|
filter: (name, value, extra) => (need("hooks", "hooks.filter"), this.hooks.filter(name, value, extra))
|
|
2396
2574
|
},
|
|
2575
|
+
notifications: { push: (n) => (need("notifications", "notifications.push"), this.notifications.push(n, id)) },
|
|
2397
2576
|
styles: { add: (st) => (need("styles", "styles.add"), track(this.styles.register(st, id))) },
|
|
2398
2577
|
host: {
|
|
2399
2578
|
has: (name) => this.hostApis.has(name),
|
|
@@ -2459,6 +2638,7 @@ var MGMT = {
|
|
|
2459
2638
|
configSchema: "flux.plugins.config.schema",
|
|
2460
2639
|
logs: "flux.plugins.logs",
|
|
2461
2640
|
diagnostics: "flux.plugins.diagnostics",
|
|
2641
|
+
details: "flux.plugins.details",
|
|
2462
2642
|
changed: "flux.plugins.changed"
|
|
2463
2643
|
};
|
|
2464
2644
|
|
|
@@ -2498,6 +2678,7 @@ export {
|
|
|
2498
2678
|
menuLocations,
|
|
2499
2679
|
manifestSchema,
|
|
2500
2680
|
validateManifest,
|
|
2681
|
+
videoEmbedUrl,
|
|
2501
2682
|
matchesPattern,
|
|
2502
2683
|
EventBus,
|
|
2503
2684
|
HookSystem,
|
|
@@ -2535,10 +2716,12 @@ export {
|
|
|
2535
2716
|
defineEvent,
|
|
2536
2717
|
defineComponent,
|
|
2537
2718
|
defineMenu,
|
|
2719
|
+
NotificationCenter,
|
|
2538
2720
|
PluginManager,
|
|
2539
2721
|
routePatternMatches,
|
|
2540
2722
|
CHANNELS,
|
|
2541
2723
|
MGMT,
|
|
2542
2724
|
pluginApi,
|
|
2543
|
-
hasPluginApi
|
|
2725
|
+
hasPluginApi,
|
|
2726
|
+
core_exports
|
|
2544
2727
|
};
|